{smcl}
{com}{sf}{ul off}{txt}{.-}
      name:  {res}<unnamed>
       {txt}log:  {res}H:\Dropbox\work\replicationpack\logs\3_Output.smcl
  {txt}log type:  {res}smcl
 {txt}opened on:  {res}29 Nov 2024, 21:04:20
{txt}
{com}. 
. ************************************************************************************************************
. /************************************** Summary Figures ************************************/
. ************************************************************************************************************
. 
. *-----------------------------------------------------------
. * Figure 1(a)-(d): Aggregate time trends for criminal cases
. *-----------------------------------------------------------
. 
. cd "$workpath"
{res}H:\Dropbox\work\replicationpack
{txt}
{com}. use mdcourtsdata_annualavg.dta, clear
{txt}
{com}. 
. * Label variables
. label variable disposition_guilty "Guilty"
{txt}
{com}. label variable wari_fta "FailToAppear"
{txt}
{com}. label variable wari_rescid "Rescidivist"
{txt}
{com}. label variable timelyrelease1 "TimelyRelease"
{txt}
{com}. label variable year_init "Year"
{txt}
{com}. label variable init_statusROR "Released"
{txt}
{com}. label variable init_statusHDOB "HeldBail"
{txt}
{com}. label variable init_statusHWOB "HeldNoBail"
{txt}
{com}. label variable bond_cash "Cash"
{txt}
{com}. label variable bond_corp "Commercial"
{txt}
{com}. label variable bond_prop "Property"
{txt}
{com}. label variable bond_upb "Unsecured Personal Bond"
{txt}
{com}. label variable bond_other "Other"
{txt}
{com}. label variable init_bailamt "BailAmtAll"
{txt}
{com}. label variable init_bailamt_cash "BailAmtCash"
{txt}
{com}. label variable init_bailamt_corp "BailAmtCorp"
{txt}
{com}. label variable init_bailamt_prop "BailAmtProp"
{txt}
{com}. label variable init_bailamt_upb "BailAmtUPB"
{txt}
{com}. label variable init_bailamt_other "BailAmtOther"
{txt}
{com}. label variable init_lnbailamt "All Bail Types"
{txt}
{com}. label variable init_lnbailamt_cash "Cash"
{txt}
{com}. label variable init_lnbailamt_corp "Commercial"
{txt}
{com}. label variable init_lnbailamt_prop "Property"
{txt}
{com}. label variable init_lnbailamt_upb "Unsecured Personal Bond"
{txt}
{com}. label variable init_lnbailamt_other "Other"
{txt}
{com}. label variable final_lnbailamt "All Bail Types"
{txt}
{com}. label variable final_lnbailamt_cash "Cash"
{txt}
{com}. label variable final_lnbailamt_corp "Commercial"
{txt}
{com}. label variable final_lnbailamt_prop "Property"
{txt}
{com}. label variable final_lnbailamt_upb "Unsecured Personal Bond"
{txt}
{com}. label variable final_lnbailamt_other "Other"
{txt}
{com}. label variable rivtROR_comm "ReleasedRIV"
{txt}
{com}. label variable ivROR_comm "ReleasedIV"
{txt}
{com}. 
. * Figure 1a: Detention outcomes
. line init_status* $rivror year_init, xlabel(2000(2)2020) ytitle(Proportion of Cases)
{res}{txt}
{com}. graph export output\figures\figure1a.png, replace
{txt}(note: file output\figures\figure1a.png not found)
(file output\figures\figure1a.png written in PNG format)

{com}. 
. 
. * Figure 1b: Case outcomes
. line timelyrelease1 disposition_guilty wari_fta wari_rescid year_init, xlabel(2000(2)2020) ytitle(Proportion of Cases)
{res}{txt}
{com}. graph export output\figures\figure1b.png, replace
{txt}(note: file output\figures\figure1b.png not found)
(file output\figures\figure1b.png written in PNG format)

{com}. 
. * Figure 1c: Bail payment types
. line bond_cash bond_corp bond_prop bond_other year_init, xlabel(2000(2)2020) ytitle(Proportion of Cases)
{res}{txt}
{com}. graph export output\figures\figure1c.png, replace
{txt}(note: file output\figures\figure1c.png not found)
(file output\figures\figure1c.png written in PNG format)

{com}. 
. * Figure 1d: ln(Final Bail Amount) by payment type
. line final_lnbailamt final_lnbailamt_cash final_lnbailamt_corp final_lnbailamt_prop final_lnbailamt_other year_init, xlabel(2000(2)2020) ytitle(Mean ln(Final Bail Amount))
{res}{txt}
{com}. graph export output\figures\figure1d.png, replace
{txt}(note: file output\figures\figure1d.png not found)
(file output\figures\figure1d.png written in PNG format)

{com}. 
. 
. *-----------------------------------------------------------
. * Figure 1(e)-(f): Aggregate time trends for financial outcomes
. *-----------------------------------------------------------
. 
. * Get Zillow data
. cd "$workpath"
{res}H:\Dropbox\work\replicationpack
{txt}
{com}. use zillow_annavg.dta, clear
{txt}
{com}. keep if inrange(year,2000,2020)
{txt}(8 observations deleted)

{com}. 
. * Get civil case data
. merge 1:1 year using mdcivildata_annualavg.dta, update assert(3)
{res}
{txt}{col 5}Result{col 38}# of obs.
{col 5}{hline 41}
{col 5}not matched{col 30}{res}               0

{txt}{col 5}matched{col 30}{res}              21
{txt}{col 9}not updated{col 30}{res}              21{txt}  (_merge==3)
{col 9}missing updated{col 30}{res}               0{txt}  (_merge==4)
{col 9}nonmissing conflict{col 30}{res}               0{txt}  (_merge==5)
{col 5}{hline 41}

{com}. drop _merge
{txt}
{com}. 
. * Get bankruptcy data
. merge 1:1 year using bankruptcies_annualavg.dta, update assert(1 3)
{res}
{txt}{col 5}Result{col 38}# of obs.
{col 5}{hline 41}
{col 5}not matched{col 30}{res}               9
{txt}{col 9}from master{col 30}{res}               9{txt}  (_merge==1)
{col 9}from using{col 30}{res}               0{txt}  (_merge==2)

{col 5}matched{col 30}{res}              12
{txt}{col 9}not updated{col 30}{res}              12{txt}  (_merge==3)
{col 9}missing updated{col 30}{res}               0{txt}  (_merge==4)
{col 9}nonmissing conflict{col 30}{res}               0{txt}  (_merge==5)
{col 5}{hline 41}

{com}. drop _merge
{txt}
{com}. 
. * Missing if zero forclosures
. replace foreclosed = . if year<=2006
{txt}(7 real changes made, 7 to missing)

{com}. 
. * Label variables
. label variable sale "Home Sales"
{txt}
{com}. label variable foreclosure "Foreclosures (Court)"
{txt}
{com}. label variable foreclosed "Foreclosures (Zillow)"
{txt}
{com}. label variable bankrupt "Bankruptcies (All)"
{txt}
{com}. label variable bankrupt_ch7 "Bankruptcies (Ch7)"
{txt}
{com}. label variable bankrupt_ch13 "Bankruptcies (Ch13)"
{txt}
{com}. label variable lien "Lien Judgments"
{txt}
{com}. label variable year "Year"
{txt}
{com}. 
. * Order variables
. order bankrupt bankrupt_ch*
{txt}
{com}. 
. * Figure 1e: bankruptcy and judgment liens
. twoway line bankrupt_ch*  lien year, xlabel(2000(2)2020) ytitle(Count)
{res}{txt}
{com}. graph export output\figures\figure1e.png, replace
{txt}(note: file output\figures\figure1e.png not found)
(file output\figures\figure1e.png written in PNG format)

{com}. 
. * Figure 1f: foreclosures
. twoway line foreclosed foreclosure year, xlabel(2000(2)2020) ytitle(Frequency)
{res}{txt}
{com}. graph export output\figures\figure1f.png, replace
{txt}(note: file output\figures\figure1f.png not found)
(file output\figures\figure1f.png written in PNG format)

{com}. 
. 
. *--------------------------------------------------
. * Figure 2: Case level histograms
. *--------------------------------------------------
. 
. * Load data
. cd "$workpath"
{res}H:\Dropbox\work\replicationpack
{txt}
{com}. use mdcourtsdata_commyravg.dta, clear
{txt}
{com}. 
. * Label variable
. label variable init_statusROR "Released"
{txt}
{com}. label variable $rivror "ReleasedRIV"
{txt}
{com}. label variable numcases_percommyr "NumCases"
{txt}
{com}. 
. * Get histogram for ROR
. hist init_statusROR if $tsfilters
{txt}(bin={res}36{txt}, start={res}0{txt}, width={res}.02777778{txt})
{res}{txt}
{com}. graph export output\figures\histogram_RORcommyr.png, replace
{txt}(note: file output\figures\histogram_RORcommyr.png not found)
(file output\figures\histogram_RORcommyr.png written in PNG format)

{com}. 
. hist init_statusROR if $tsfilters & numcases_percommyr>50
{txt}(bin={res}32{txt}, start={res}.06024097{txt}, width={res}.02145804{txt})
{res}{txt}
{com}. graph export output\figures\histogram_RORcommyr_50casesplus.png, replace
{txt}(note: file output\figures\histogram_RORcommyr_50casesplus.png not found)
(file output\figures\histogram_RORcommyr_50casesplus.png written in PNG format)

{com}. 
. * Get histogram for number of cases
. hist numcases_percommyr if $tsfilters
{txt}(bin={res}36{txt}, start={res}1{txt}, width={res}51.611111{txt})
{res}{txt}
{com}. graph export output\figures\histogram_numcasescommyr.png, replace
{txt}(note: file output\figures\histogram_numcasescommyr.png not found)
(file output\figures\histogram_numcasescommyr.png written in PNG format)

{com}. 
. hist numcases_percommyr if $tsfilters & numcases_percommyr>50
{txt}(bin={res}32{txt}, start={res}51{txt}, width={res}56.5{txt})
{res}{txt}
{com}. graph export output\figures\histogram_numcasescommyr_50casesplus.png, replace
{txt}(note: file output\figures\histogram_numcasescommyr_50casesplus.png not found)
(file output\figures\histogram_numcasescommyr_50casesplus.png written in PNG format)

{com}. 
. 
. *--------------------------------------------------
. * Figure 6: First-stage relevance scatterplots
. *--------------------------------------------------
. 
. * Load data
. cd "$workpath"
{res}H:\Dropbox\work\replicationpack
{txt}
{com}. use analysis_sample.dta, clear
{txt}
{com}. 
. * Label variable
. label variable init_statusROR "Released"
{txt}
{com}. label variable $rivror "ReleasedRIV"
{txt}
{com}. label variable ivROR_comm "ReleasedIV"
{txt}
{com}. 
. * Generate bins
. fastxtile rivtROR_binnum = $rivror if $tsfilters & $xsfilters, nq(80)
{txt}
{com}. fastxtile ivROR_binnum = ivROR_comm if $tsfilters & $xsfilters, nq(80)
{txt}
{com}. foreach ivtype in iv rivt {c -(}
{txt}  2{com}.         egen init_statusROR_`ivtype' = mean(init_statusROR) if $tsfilters & $xsfilters, by(`ivtype'ROR_binnum)
{txt}  3{com}.         egen detained_`ivtype' = mean(detained) if $tsfilters & $xsfilters, by(`ivtype'ROR_binnum)
{txt}  4{com}.         egen `ivtype'ROR_med = median(`ivtype'ROR_comm) if $tsfilters & $xsfilters, by(`ivtype'ROR_binnum)
{txt}  5{com}. {c )-}
{txt}(684,349 missing values generated)
(684,349 missing values generated)
(684,349 missing values generated)
(684,349 missing values generated)
(684,349 missing values generated)
(700,412 missing values generated)

{com}. label variable ivROR_med "ReleasedIV"
{txt}
{com}. label variable rivtROR_med "ReleasedRIV"
{txt}
{com}. label variable init_statusROR_iv "Released"
{txt}
{com}. label variable init_statusROR_rivt "Released"
{txt}
{com}. 
. * Figure 3a
. twoway lfitci init_statusROR $rivror if $tsfilters & $xsfilters, stdp estopts(cluster(init_commissionerid)) ytitle(Released) || ///
> scatter init_statusROR_rivt rivtROR_med if $tsfilters & $xsfilters, msize(medsmall) mcolor(teal) legend(order(1 2))
{res}{txt}
{com}. graph export output\figures\figure3a.png, replace
{txt}(file output\figures\figure3a.png written in PNG format)

{com}. 
. * Figure 3b
. twoway lfitci init_statusROR ivROR_comm if $tsfilters & $xsfilters, stdp estopts(cluster(init_commissionerid)) ytitle(Released) || ///
> scatter init_statusROR_iv ivROR_med if $tsfilters & $xsfilters, msize(medsmall) mcolor(teal) legend(order(1 2)) 
{res}{txt}
{com}. graph export output\figures\figure3b.png, replace
{txt}(file output\figures\figure3b.png written in PNG format)

{com}. 
. *--------------------------------------------------
. * Figure 6: Histogram of HPI changes
. *--------------------------------------------------
. 
. * Load data
. cd "$workpath"
{res}H:\Dropbox\work\replicationpack
{txt}
{com}. use analysis_sample.dta, clear
{txt}
{com}. 
. * Label variable
. label variable hpichange "Annual HPI Growth (%)"
{txt}
{com}. 
. * Get histogram for HPI change
. hist hpichange if $tsfilters & $zfilters
{txt}(bin={res}54{txt}, start={res}-31.56{txt}, width={res}1.1675926{txt})
{res}{txt}
{com}. graph export output\figures\figure6.png, replace
{txt}(note: file output\figures\figure6.png not found)
(file output\figures\figure6.png written in PNG format)

{com}. 
. 
. ************************************************************************************************************
. ********************************* Regression Results ************************************/
. ************************************************************************************************************
. 
. *--------------------------------------------------
. * Load data
. *--------------------------------------------------
. 
. * Load data
. cd "$workpath"
{res}H:\Dropbox\work\replicationpack
{txt}
{com}. use analysis_sample.dta, clear
{txt}
{com}. 
. *--------------------------------------------------
. * Label variables
. *--------------------------------------------------
. 
. * Label variables
. label variable init_statusROR "Released"
{txt}
{com}. label variable detained "Detained"
{txt}
{com}. label variable timelyrelease1 "TimelyRelease"
{txt}
{com}. label variable disposition_guilty "Guilty"
{txt}
{com}. label variable wari_fta "FailToAppear"
{txt}
{com}. label variable wari_rescid "Rescidivist"
{txt}
{com}. label variable bailreview "BailReview"
{txt}
{com}. label variable bond_cash "BondCash"
{txt}
{com}. label variable bond_corp "BondComm"
{txt}
{com}. label variable bond_prop "BondProp"
{txt}
{com}. label variable bond_upb "BondUPB"
{txt}
{com}. label variable bond_parb "BondPart"
{txt}
{com}. label variable bond_pct "BondPct"
{txt}
{com}. label variable bond_other "BondOther"
{txt}
{com}. label variable ln_timedetained "lnTimeDetained"
{txt}
{com}. label variable ln_age "lnAge"
{txt}
{com}. label variable male "Male"
{txt}
{com}. label variable black "Black"
{txt}
{com}. label variable charge_felony "FelonyCharge"
{txt}
{com}. label variable ivROR_comm "ReleasedIV"
{txt}
{com}. label variable rivtROR_comm "ReleasedRIV"
{txt}
{com}. label variable init_lnbailamt "lnBailAmt"
{txt}
{com}. label variable final_bailamt "FinalBailAmt"
{txt}
{com}. label variable init_bailamt "InitBailAmt"
{txt}
{com}. 
. *--------------------------------------------------
. * Summary statistics for case-level variables
. *--------------------------------------------------
. 
. * Table 1a: summary stats all case variables except bail amount
. eststo clear
{txt}
{com}. local lhsvars "init_statusROR detained"
{txt}
{com}. local charvars "black male ln_age charge_felony"
{txt}
{com}. local outcomevars "ln_timedetained timelyrelease1 disposition_guilty wari_fta wari_rescid" 
{txt}
{com}. local bailvars "bailreview bond_cash bond_corp bond_prop bond_other"
{txt}
{com}. local ivvars "$rivror ivROR_comm"
{txt}
{com}. quietly estpost tabstat `lhsvars' `charvars' `outcomevars' `bailvars' `ivvars' if $xsfilters & $tsfilters, stat(count mean sd p25 med p75) columns(statistics)
{txt}
{com}. * Working Output
. esttab, nonum noobs nonote compress label ///
> cells("count(label(Observations) fmt(%9.0fc)) mean(label(Mean) fmt(%9.3f)) sd(label(Std Dev) fmt(%9.3f)) p25(label(P25) fmt(%9.3f)) p50(label(Median) fmt(%9.3f)) p75(label(P75) fmt(%9.3f))") 
{res}
{txt}{hline 76}
{txt}                                                                            
{txt}                 Observa~s      Mean   Std Dev       P25    Median       P75
{txt}{hline 76}
{txt}Released        {res}   520,275     0.452     0.498     0.000     0.000     1.000{txt}
{txt}Detained        {res}   520,275     0.548     0.498     0.000     1.000     1.000{txt}
{txt}Black           {res}   520,275     0.809     0.393     1.000     1.000     1.000{txt}
{txt}Male            {res}   520,275     0.833     0.373     1.000     1.000     1.000{txt}
{txt}lnAge           {res}   519,128     3.437     0.339     3.135     3.434     3.714{txt}
{txt}FelonyCharge    {res}   520,275     0.205     0.403     0.000     0.000     0.000{txt}
{txt}lnTimeDetained  {res}   455,294     0.701     1.222     0.000     0.000     0.693{txt}
{txt}TimelyRelease   {res}   520,275     0.669     0.471     0.000     1.000     1.000{txt}
{txt}Guilty          {res}   520,275     0.135     0.342     0.000     0.000     0.000{txt}
{txt}FailToAppear    {res}   520,275     0.112     0.315     0.000     0.000     0.000{txt}
{txt}Rescidivist     {res}   520,275     0.040     0.195     0.000     0.000     0.000{txt}
{txt}BailReview      {res}   520,275     0.378     0.485     0.000     0.000     1.000{txt}
{txt}BondCash        {res}   520,275     0.021     0.144     0.000     0.000     0.000{txt}
{txt}BondComm        {res}   520,275     0.182     0.386     0.000     0.000     0.000{txt}
{txt}BondProp        {res}   520,275     0.026     0.159     0.000     0.000     0.000{txt}
{txt}BondOther       {res}   520,275     0.023     0.151     0.000     0.000     0.000{txt}
{txt}ReleasedRIV     {res}   504,212     0.001     0.081    -0.050     0.001     0.051{txt}
{txt}ReleasedIV      {res}   520,275     0.451     0.106     0.380     0.460     0.527{txt}
{txt}{hline 76}

{com}. * LaTeX output
. esttab using output\tables\table1a_exceptbailamt.tex, f replace ///
> nonum noobs nonote compress label booktabs ///
> cells("count(label(Observations) fmt(%9.0fc)) mean(label(Mean) fmt(%9.3f)) sd(label(Std Dev) fmt(%9.3f)) p25(label(P25) fmt(%9.3f)) p50(label(Median) fmt(%9.3f)) p75(label(P75) fmt(%9.3f))") 
{res}{txt}(output written to {browse  `"output\tables\table1a_exceptbailamt.tex"'})

{com}. 
. * Scale variables (in thousands)
. foreach var of varlist init_bailamt final_bailamt {c -(}
{txt}  2{com}.         replace `var' = `var'/1000
{txt}  3{com}. {c )-}
{txt}(588,487 real changes made)
(636,942 real changes made)

{com}. 
. * Table 1a: summary stats for bail amount variables (conditional on initial bail amount > 0)
. eststo clear
{txt}
{com}. local bailvars "init_bailamt final_bailamt"
{txt}
{com}. quietly estpost tabstat `bailvars' if $xsfilters & $tsfilters & init_bailamt>0, stat(count mean sd p25 med p75) columns(statistics)
{txt}
{com}. * Working Output
. esttab, nonum noobs nonote compress label ///
> cells("count(label(Observations) fmt(%9.0fc)) mean(label(Mean) fmt(%9.3f)) sd(label(Std Dev) fmt(%9.3f)) p25(label(P25) fmt(%9.3f)) p50(label(Median) fmt(%9.3f)) p75(label(P75) fmt(%9.3f))") 
{res}
{txt}{hline 76}
{txt}                                                                            
{txt}                 Observa~s      Mean   Std Dev       P25    Median       P75
{txt}{hline 76}
{txt}InitBailAmt     {res}   253,895    30.708    58.129     3.500     7.500    25.000{txt}
{txt}FinalBailAmt    {res}   253,895    23.622    46.328     2.500     5.000    25.000{txt}
{txt}{hline 76}

{com}. * LaTeX output
. esttab using output\tables\table1a_bailamt.tex, f replace ///
> nonum noobs nonote compress label booktabs ///
> cells("count(label(Observations) fmt(%9.0fc)) mean(label(Mean) fmt(%9.3f)) sd(label(Std Dev) fmt(%9.3f)) p25(label(P25) fmt(%9.3f)) p50(label(Median) fmt(%9.3f)) p75(label(P75) fmt(%9.3f))") 
{res}{txt}(output written to {browse  `"output\tables\table1a_bailamt.tex"'})

{com}. 
. *--------------------------------------------------
. * Summary statistics for financial variables
. *--------------------------------------------------
. 
. * Label financial variables at different horizons
. foreach m in 3 6 {c -(}
{txt}  2{com}.         foreach var of varlist *_`m'mos {c -(}
{txt}  3{com}.                 label variable `var' "`m' Months"
{txt}  4{com}.                 label variable `var'pre "-`m' Months"
{txt}  5{com}.         {c )-}
{txt}  6{com}. {c )-}
{txt}
{com}. foreach var of varlist *_1yr {c -(}
{txt}  2{com}.         label variable `var' "1 Year"
{txt}  3{com}.         label variable `var'pre "-1 Year"
{txt}  4{com}. {c )-}
{txt}
{com}. foreach y in 2 3 {c -(}
{txt}  2{com}.         foreach var of varlist *_`y'yr {c -(}
{txt}  3{com}.                 label variable `var' "`y' Years"
{txt}  4{com}.                 label variable `var'pre "-`y' Years"
{txt}  5{com}.         {c )-}
{txt}  6{com}. {c )-}
{txt}
{com}. 
. * Table 1a: Ch 7 bankruptcy rates at different horizons
. eststo clear
{txt}
{com}. local var zbankrupt7
{txt}
{com}. local vars "`var'_2yrpre `var'_1yrpre `var'_6mospre `var'_3mospre `var'_3mos `var'_6mos `var'_1yr `var'_2yr `var'_3yr"
{txt}
{com}. local tsfilters "inrange(year_init,2000,2008)"
{txt}
{com}. quietly estpost tabstat `vars' if $xsfilters & `tsfilters', stat(mean sd) columns(statistics)
{txt}
{com}. esttab, nonum noobs nonote compress label ///
> cells("mean(label(Mean) fmt(%9.3f)) sd(label(Std Dev) fmt(%9.3f))") 
{res}
{txt}{hline 36}
{txt}                                    
{txt}                      Mean   Std Dev
{txt}{hline 36}
{txt}-2 Years        {res}     0.022     0.148{txt}
{txt}-1 Year         {res}     0.012     0.107{txt}
{txt}-6 Months       {res}     0.006     0.078{txt}
{txt}-3 Months       {res}     0.003     0.055{txt}
{txt}3 Months        {res}     0.003     0.054{txt}
{txt}6 Months        {res}     0.006     0.076{txt}
{txt}1 Year          {res}     0.011     0.104{txt}
{txt}2 Years         {res}     0.020     0.139{txt}
{txt}3 Years         {res}     0.026     0.161{txt}
{txt}{hline 36}

{com}. 
. * Table 1a: Ch 13 bankruptcy rates at different horizons
. eststo clear
{txt}
{com}. local var zbankrupt13
{txt}
{com}. local vars "`var'_2yrpre `var'_1yrpre `var'_6mospre `var'_3mospre `var'_3mos `var'_6mos `var'_1yr `var'_2yr `var'_3yr"
{txt}
{com}. local tsfilters "inrange(year_init,2000,2008)"
{txt}
{com}. quietly estpost tabstat `vars' if $xsfilters & `tsfilters', stat(mean sd) columns(statistics)
{txt}
{com}. esttab, nonum noobs nonote compress label ///
> cells("mean(label(Mean) fmt(%9.3f)) sd(label(Std Dev) fmt(%9.3f))") 
{res}
{txt}{hline 36}
{txt}                                    
{txt}                      Mean   Std Dev
{txt}{hline 36}
{txt}-2 Years        {res}     0.014     0.117{txt}
{txt}-1 Year         {res}     0.008     0.091{txt}
{txt}-6 Months       {res}     0.004     0.066{txt}
{txt}-3 Months       {res}     0.002     0.048{txt}
{txt}3 Months        {res}     0.002     0.047{txt}
{txt}6 Months        {res}     0.004     0.064{txt}
{txt}1 Year          {res}     0.008     0.087{txt}
{txt}2 Years         {res}     0.013     0.112{txt}
{txt}3 Years         {res}     0.016     0.125{txt}
{txt}{hline 36}

{com}. 
. * Table 1a: judgment lien rates at different horizons
. eststo clear
{txt}
{com}. local var zlien
{txt}
{com}. local vars "`var'_2yrpre `var'_1yrpre `var'_6mospre `var'_3mospre `var'_3mos `var'_6mos `var'_1yr `var'_2yr `var'_3yr"
{txt}
{com}. quietly estpost tabstat `vars' if $xsfilters & $tsfilters, stat(mean sd) columns(statistics)
{txt}
{com}. esttab, nonum noobs nonote compress label ///
> cells("mean(label(Mean) fmt(%9.3f)) sd(label(Std Dev) fmt(%9.3f))") 
{res}
{txt}{hline 36}
{txt}                                    
{txt}                      Mean   Std Dev
{txt}{hline 36}
{txt}-2 Years        {res}     0.009     0.096{txt}
{txt}-1 Year         {res}     0.006     0.075{txt}
{txt}-6 Months       {res}     0.003     0.055{txt}
{txt}-3 Months       {res}     0.002     0.040{txt}
{txt}3 Months        {res}     0.002     0.042{txt}
{txt}6 Months        {res}     0.004     0.065{txt}
{txt}1 Year          {res}     0.008     0.090{txt}
{txt}2 Years         {res}     0.013     0.112{txt}
{txt}3 Years         {res}     0.016     0.126{txt}
{txt}{hline 36}

{com}. 
. * Table 1a: foreclosure rates at different horizons (condition on prior transaction)
. eststo clear
{txt}
{com}. local var "zfcl"
{txt}
{com}. local vars "`var'_2yrpre `var'_1yrpre `var'_6mospre `var'_3mospre `var'_3mos `var'_6mos `var'_1yr `var'_2yr `var'_3yr"
{txt}
{com}. quietly estpost tabstat `vars' if $zfilters & $tsfilters, stat(mean sd) columns(statistics)
{txt}
{com}. esttab, nonum noobs nonote compress label ///
> cells("mean(label(Mean) fmt(%9.3f)) sd(label(Std Dev) fmt(%9.3f))") 
{res}
{txt}{hline 36}
{txt}                                    
{txt}                      Mean   Std Dev
{txt}{hline 36}
{txt}-2 Years        {res}     0.040     0.196{txt}
{txt}-1 Year         {res}     0.027     0.162{txt}
{txt}-6 Months       {res}     0.017     0.129{txt}
{txt}-3 Months       {res}     0.010     0.098{txt}
{txt}3 Months        {res}     0.010     0.101{txt}
{txt}6 Months        {res}     0.020     0.140{txt}
{txt}1 Year          {res}     0.038     0.192{txt}
{txt}2 Years         {res}     0.069     0.253{txt}
{txt}3 Years         {res}     0.093     0.291{txt}
{txt}{hline 36}

{com}. 
. * Table 1a: overall insolvency rates at different horizons (condition on prior transaction)
. eststo clear
{txt}
{com}. local var "zinsolvent"
{txt}
{com}. local vars "`var'_2yrpre `var'_1yrpre `var'_6mospre `var'_3mospre `var'_3mos `var'_6mos `var'_1yr `var'_2yr `var'_3yr"
{txt}
{com}. quietly estpost tabstat `vars' if $zfilters & $tsfilters, stat(mean sd) columns(statistics)
{txt}
{com}. esttab, nonum noobs nonote compress label ///
> cells("mean(label(Mean) fmt(%9.3f)) sd(label(Std Dev) fmt(%9.3f))") 
{res}
{txt}{hline 36}
{txt}                                    
{txt}                      Mean   Std Dev
{txt}{hline 36}
{txt}-2 Years        {res}     0.084     0.278{txt}
{txt}-1 Year         {res}     0.054     0.226{txt}
{txt}-6 Months       {res}     0.032     0.176{txt}
{txt}-3 Months       {res}     0.018     0.132{txt}
{txt}3 Months        {res}     0.018     0.133{txt}
{txt}6 Months        {res}     0.036     0.186{txt}
{txt}1 Year          {res}     0.068     0.251{txt}
{txt}2 Years         {res}     0.114     0.318{txt}
{txt}3 Years         {res}     0.148     0.355{txt}
{txt}{hline 36}

{com}. 
. 
. *--------------------------------------------------
. * Table 2 - Test of randomization
. *--------------------------------------------------
. 
. * Label covariates
. foreach type in "3yr"{c -(}
{txt}  2{com}.         label variable zinsolvent_`type'pre "InsolventPrev`type'"
{txt}  3{com}.         label variable zfcl_`type'pre "ForeclosePrev`type'"
{txt}  4{com}.         label variable zbankrupt_`type'pre "BankruptPrev`type'"
{txt}  5{com}.         label variable zbankrupt7_`type'pre "Bankrupt7Prev`type'"
{txt}  6{com}.         label variable zbankrupt13_`type'pre "Bankrupt13Prev`type'"
{txt}  7{com}.         label variable zlien_`type'pre "LienPrev`type'"
{txt}  8{com}.         label variable zsellhouse_`type'pre "SellHousePrev`type'"               
{txt}  9{com}. {c )-}
{txt}
{com}. 
. * Table 2 - Test of randomization
. local rhsvars "ln_age black male charge_felony zinsolvent_3yrpre zfcl_3yrpre zbankrupt7_3yrpre zbankrupt13_3yrpre zlien_3yrpre zsellhouse_3yrpre"
{txt}
{com}. local fevars "courtyr zipyr"
{txt}
{com}. eststo clear
{txt}
{com}. foreach lhsvar of varlist init_statusROR ivROR_comm $rivror {c -(}
{txt}  2{com}.         eststo `lhsvar': quietly reghdfe `lhsvar' `rhsvars' if $xsfilters & $tsfilters, absorb(`fevars') cluster(init_commissionerid)   
{txt}  3{com}.         quietly estadd local courtyrfe "X"
{txt}  4{com}.         quietly estadd local zipyrfe "X"
{txt}  5{com}. {c )-}
{txt}
{com}. esttab, noconstant b(%5.4f) se(%5.4f) star(* 0.1 ** 0.05 *** 0.01) par depvars label collabels(none) ar2 ///
> s(p courtyrfe zipyrfe N r2_a, label("Joint F-test" "Court-Year FE" "Zip-Year FE" "Observations" "Adjusted R-squared") ///
> fmt(4 0 0 %9.0fc 3)) nonotes // bottom summary
{res}
{txt}{hline 68}
{txt}                              (1)             (2)             (3)   
{txt}                         Released      ReleasedIV     ReleasedRIV   
{txt}{hline 68}
{txt}lnAge               {res}       0.0557***       0.0003          0.0001   {txt}
                    {res} {ralign 12:{txt:(}0.0066{txt:)}}    {ralign 12:{txt:(}0.0008{txt:)}}    {ralign 12:{txt:(}0.0007{txt:)}}   {txt}

{txt}Black               {res}      -0.0292***       0.0001         -0.0004   {txt}
                    {res} {ralign 12:{txt:(}0.0031{txt:)}}    {ralign 12:{txt:(}0.0004{txt:)}}    {ralign 12:{txt:(}0.0004{txt:)}}   {txt}

{txt}Male                {res}      -0.1053***      -0.0032         -0.0015   {txt}
                    {res} {ralign 12:{txt:(}0.0058{txt:)}}    {ralign 12:{txt:(}0.0026{txt:)}}    {ralign 12:{txt:(}0.0016{txt:)}}   {txt}

{txt}FelonyCharge        {res}      -0.4390***      -0.0034***      -0.0002   {txt}
                    {res} {ralign 12:{txt:(}0.0077{txt:)}}    {ralign 12:{txt:(}0.0007{txt:)}}    {ralign 12:{txt:(}0.0006{txt:)}}   {txt}

{txt}InsolventPrev3yr    {res}       0.0022          0.0023          0.0019   {txt}
                    {res} {ralign 12:{txt:(}0.0085{txt:)}}    {ralign 12:{txt:(}0.0017{txt:)}}    {ralign 12:{txt:(}0.0016{txt:)}}   {txt}

{txt}ForeclosePrev3yr    {res}      -0.0044         -0.0023         -0.0020   {txt}
                    {res} {ralign 12:{txt:(}0.0083{txt:)}}    {ralign 12:{txt:(}0.0015{txt:)}}    {ralign 12:{txt:(}0.0014{txt:)}}   {txt}

{txt}Bankrupt7Prev3yr    {res}       0.0086         -0.0020         -0.0013   {txt}
                    {res} {ralign 12:{txt:(}0.0086{txt:)}}    {ralign 12:{txt:(}0.0016{txt:)}}    {ralign 12:{txt:(}0.0016{txt:)}}   {txt}

{txt}Bankrupt13Prev3yr   {res}       0.0036         -0.0012         -0.0012   {txt}
                    {res} {ralign 12:{txt:(}0.0078{txt:)}}    {ralign 12:{txt:(}0.0016{txt:)}}    {ralign 12:{txt:(}0.0015{txt:)}}   {txt}

{txt}LienPrev3yr         {res}      -0.0239**       -0.0054***      -0.0046** {txt}
                    {res} {ralign 12:{txt:(}0.0095{txt:)}}    {ralign 12:{txt:(}0.0020{txt:)}}    {ralign 12:{txt:(}0.0020{txt:)}}   {txt}

{txt}SellHousePrev3yr    {res}       0.0020         -0.0002         -0.0001   {txt}
                    {res} {ralign 12:{txt:(}0.0017{txt:)}}    {ralign 12:{txt:(}0.0005{txt:)}}    {ralign 12:{txt:(}0.0004{txt:)}}   {txt}
{txt}{hline 68}
{txt}Joint F-test        {res}       0.0000          0.0001          0.4993   {txt}
{txt}Court-Year FE       {res}            X               X               X   {txt}
{txt}Zip-Year FE         {res}            X               X               X   {txt}
{txt}Observations        {res}      517,766         517,766         502,857   {txt}
{txt}Adjusted R-squared  {res}        0.162           0.354           0.003   {txt}
{txt}{hline 68}

{com}. 
. * Latex Output
. esttab using output\tables\table2.tex, noconstant replace ///
> b(%5.4f) se(%5.4f) star(* 0.1 ** 0.05 *** 0.01) par depvars label collabels(none) ar2 ///
> s(p courtyrfe zipyrfe N r2_a, label("Joint F-test" "Court-Year FE" "Zip-Year FE" "Observations" "Adjusted R-squared") ///
> fmt(4 0 0 %9.0fc 3)) nonotes booktabs // bottom summary
{res}{txt}(output written to {browse  `"output\tables\table2.tex"'})

{com}. 
. *--------------------------------------------------
. ** Table 3 - IV first stage across subsamples
. *--------------------------------------------------
. 
. * Table 3 - IV first stage across subsamples
. local lhsvar "detained"
{txt}
{com}. local rhsvar "$rivror"
{txt}
{com}. local subfilter1 "1"
{txt}
{com}. local subfilter2 "black==1"
{txt}
{com}. local subfilter3 "black==0"
{txt}
{com}. local subfilter4 "male==1"
{txt}
{com}. local subfilter5 "male==0"
{txt}
{com}. local subfilter6 "young==1"
{txt}
{com}. local subfilter7 "young==0"
{txt}
{com}. local subfilter8 "Court==1"
{txt}
{com}. local subfilter9 "Court==2"
{txt}
{com}. local subfilter10 "Court==3"
{txt}
{com}. local subfilter11 "charge_felony==1"
{txt}
{com}. local subfilter12 "charge_felony==0"
{txt}
{com}. local subfilterlab1 "All"
{txt}
{com}. local subfilterlab2 "Black"
{txt}
{com}. local subfilterlab3 "NonBlack"
{txt}
{com}. local subfilterlab4 "Male"
{txt}
{com}. local subfilterlab5 "Female"
{txt}
{com}. local subfilterlab6 "Young"
{txt}
{com}. local subfilterlab7 "Old"
{txt}
{com}. local subfilterlab8 "Baltimore"
{txt}
{com}. local subfilterlab9 "Montgomery"
{txt}
{com}. local subfilterlab10 "PrinceGeorge"
{txt}
{com}. local subfilterlab11 "Felony"
{txt}
{com}. local subfilterlab12 "Misdemeanor"
{txt}
{com}. eststo clear
{txt}
{com}. forvalues i=1/10 {c -(}
{txt}  2{com}.         eststo `subfilterlab`i'': quietly reghdfe `lhsvar' `rhsvar' if $xsfilters & $tsfilters & `subfilter`i'', absorb($fevars) cluster($ivclustvar)
{txt}  3{com}.         quietly estadd local courtyrfe "X"
{txt}  4{com}.         quietly estadd local zipyrfe "X"
{txt}  5{com}.         quietly estadd local monthfe "X"
{txt}  6{com}.         quietly estadd local dowfe "X"
{txt}  7{com}.         quietly estadd local sexfe "X"
{txt}  8{com}.         quietly estadd local racefe "X"
{txt}  9{com}.         quietly estadd local chargefe "X"
{txt} 10{com}. {c )-}
{txt}
{com}. esttab, noconstant b(%5.4f) se(%5.4f) star(* 0.1 ** 0.05 *** 0.01) par depvars label collabels(none) ar2 mtitles ///
> s(F $felabs N r2_a, ///
> label("F-statistic" "Court-Year FE" "Zip-Year FE" "Month FE" "DOW FE" "Sex FE" "Race FE" "Charge FE" "Observations" "Adjusted R-squared") ///
> fmt(2 0 0 0 0 0 0 0 %9.0fc 3)) nonotes // bottom summary
{res}
{txt}{hline 180}
{txt}                              (1)             (2)             (3)             (4)             (5)             (6)             (7)             (8)             (9)            (10)   
{txt}                              All           Black        NonBlack            Male          Female           Young             Old       Baltimore      Montgomery    PrinceGeorge   
{txt}{hline 180}
{txt}ReleasedRIV         {res}      -0.9457***      -0.9363***      -0.9766***      -0.9182***      -1.0819***      -0.8980***      -0.9858***      -0.9502***      -0.9888***      -0.9350***{txt}
                    {res} {ralign 12:{txt:(}0.0081{txt:)}}    {ralign 12:{txt:(}0.0103{txt:)}}    {ralign 12:{txt:(}0.0243{txt:)}}    {ralign 12:{txt:(}0.0114{txt:)}}    {ralign 12:{txt:(}0.0327{txt:)}}    {ralign 12:{txt:(}0.0154{txt:)}}    {ralign 12:{txt:(}0.0153{txt:)}}    {ralign 12:{txt:(}0.0091{txt:)}}    {ralign 12:{txt:(}0.0327{txt:)}}    {ralign 12:{txt:(}0.0215{txt:)}}   {txt}
{txt}{hline 180}
{txt}F-statistic         {res}     13526.11         8331.70         1621.18         6541.45         1096.61         3421.76         4140.82        10978.81          912.74         1887.23   {txt}
{txt}Court-Year FE       {res}            X               X               X               X               X               X               X               X               X               X   {txt}
{txt}Zip-Year FE         {res}            X               X               X               X               X               X               X               X               X               X   {txt}
{txt}Month FE            {res}            X               X               X               X               X               X               X               X               X               X   {txt}
{txt}DOW FE              {res}            X               X               X               X               X               X               X               X               X               X   {txt}
{txt}Sex FE              {res}            X               X               X               X               X               X               X               X               X               X   {txt}
{txt}Race FE             {res}            X               X               X               X               X               X               X               X               X               X   {txt}
{txt}Charge FE           {res}            X               X               X               X               X               X               X               X               X               X   {txt}
{txt}Observations        {res}      502,546         407,277          94,360         418,586          83,019         230,321         271,231         392,018          33,635          75,019   {txt}
{txt}Adjusted R-squared  {res}        0.338           0.343           0.319           0.350           0.258           0.363           0.325           0.370           0.262           0.240   {txt}
{txt}{hline 180}

{com}. 
. * LaTex output
. esttab using output\tables\table3.tex, replace noconstant b(%5.4f) se(%5.4f) star(* 0.1 ** 0.05 *** 0.01) par depvars label collabels(none) ar2 mtitles ///
> s(F $felabs N r2_a, ///
> label("F-statistic" "Court-Year FE" "Zip-Year FE" "Month FE" "DOW FE" "Sex FE" "Race FE" "Charge FE" "Observations" "Adjusted R-squared") ///
> fmt(2 0 0 0 0 0 0 0 %9.0fc 3)) nonotes booktabs // bottom summary
{res}{txt}(output written to {browse  `"output\tables\table3.tex"'})

{com}. 
. *-----------------------------------------------------------
. * Table 4 - effect of pretrial release on pretrial outcomes
. *-----------------------------------------------------------
. 
. * Table 4a - OLS
. local rhsvars "detained"
{txt}
{com}. eststo clear
{txt}
{com}. foreach lhsvar of varlist timelyrelease1 ln_timedetained disposition_guilty wari_fta wari_rescid {c -(}
{txt}  2{com}.         eststo `lhsvar': quietly reghdfe `lhsvar' `rhsvars' if $tsfilters & $xsfilters, absorb($fevars) cluster($ivclustvar)
{txt}  3{com}.         quietly estadd local fes "Yes"
{txt}  4{com}.         quietly sum `lhsvar' if e(sample)
{txt}  5{com}.         quietly estadd scalar lhsmean = r(mean)
{txt}  6{com}.         quietly estadd scalar lhssd = r(sd)
{txt}  7{com}. {c )-}
{txt}
{com}. esttab, noconstant b(%5.4f) se(%5.4f) star(* 0.1 ** 0.05 *** 0.01) par depvars label collabels(none) ar2 ///
> s(lhsmean lhssd fes N r2_a, ///
> label("Mean(dep. var.)" "SD(dep. var.)" "Fixed Effects" "Observations" "Adjusted R-squared") ///
> fmt(4 4 0 %9.0fc 3)) nonotes // bottom summary
{res}
{txt}{hline 100}
{txt}                              (1)             (2)             (3)             (4)             (5)   
{txt}                     TimelyRele~e    lnTimeDeta~d          Guilty    FailToAppear     Rescidivist   
{txt}{hline 100}
{txt}Detained            {res}      -0.5481***       1.3926***       0.0034         -0.0876***       0.0077***{txt}
                    {res} {ralign 12:{txt:(}0.0045{txt:)}}    {ralign 12:{txt:(}0.0123{txt:)}}    {ralign 12:{txt:(}0.0021{txt:)}}    {ralign 12:{txt:(}0.0023{txt:)}}    {ralign 12:{txt:(}0.0013{txt:)}}   {txt}
{txt}{hline 100}
{txt}Mean(dep. var.)     {res}       0.6673          0.7019          0.1349          0.1120          0.0405   {txt}
{txt}SD(dep. var.)       {res}       0.4712          1.2208          0.3416          0.3154          0.1971   {txt}
{txt}Fixed Effects       {res}          Yes             Yes             Yes             Yes             Yes   {txt}
{txt}Observations        {res}      503,617         439,732         503,617         503,617         503,617   {txt}
{txt}Adjusted R-squared  {res}        0.450           0.385           0.098           0.081           0.022   {txt}
{txt}{hline 100}

{com}. 
. * Latex Output
. esttab using output\tables\table4a.tex, noconstant replace ///
> b(%5.4f) se(%5.4f) star(* 0.1 ** 0.05 *** 0.01) par depvars label collabels(none) ar2 ///
> s(lhsmean lhssd fes N r2_a, ///
> label("Mean(dep. var.)" "SD(dep. var.)" "Fixed Effects" "Observations" "Adjusted R-squared") ///
> fmt(4 4 0 %9.0fc 3)) nonotes booktabs // bottom summary
{res}{txt}(output written to {browse  `"output\tables\table4a.tex"'})

{com}. 
. 
. * Table 4b - 2SLS
. local iv "detained = $rivror"
{txt}
{com}. eststo clear
{txt}
{com}. foreach lhsvar of varlist timelyrelease1 ln_timedetained disposition_guilty wari_fta wari_rescid {c -(}
{txt}  2{com}.         eststo `lhsvar': quietly ivreghdfe `lhsvar' (`iv') `ctrlvars' if $tsfilters & $xsfilters, absorb($fevars) cluster($ivclustvar) ffirst
{txt}  3{com}.         matrix firstmat = e(first) // First-stage statistics
{txt}  4{com}.         quietly estadd scalar fstat = firstmat[4,1] // Store first-stage F-stat 
{txt}  5{com}.         quietly estadd local fes "Yes"
{txt}  6{com}.         quietly sum `lhsvar' if e(sample)
{txt}  7{com}.         quietly estadd scalar lhsmean = r(mean)
{txt}  8{com}.         quietly estadd scalar lhssd = r(sd)
{txt}  9{com}. {c )-}
{txt}
{com}. esttab, b(%5.4f) se(%5.4f) star(* 0.1 ** 0.05 *** 0.01) par depvars label collabels(none) ar2 ///
> s(lhsmean lhssd fstat fes N, ///
> label("Mean(dep. var.)" "SD(dep. var.)" "1st Stage F-Stat" "Fixed Effects" "Observations") ///
> fmt(4 4 2 0 %9.0fc)) nonotes // bottom summary
{res}
{txt}{hline 100}
{txt}                              (1)             (2)             (3)             (4)             (5)   
{txt}                     TimelyRele~e    lnTimeDeta~d          Guilty    FailToAppear     Rescidivist   
{txt}{hline 100}
{txt}Detained            {res}      -0.5441***       1.3162***       0.0356***      -0.1301***       0.0191***{txt}
                    {res} {ralign 12:{txt:(}0.0163{txt:)}}    {ralign 12:{txt:(}0.0514{txt:)}}    {ralign 12:{txt:(}0.0086{txt:)}}    {ralign 12:{txt:(}0.0094{txt:)}}    {ralign 12:{txt:(}0.0032{txt:)}}   {txt}
{txt}{hline 100}
{txt}Mean(dep. var.)     {res}       0.6674          0.7012          0.1350          0.1121          0.0405   {txt}
{txt}SD(dep. var.)       {res}       0.4712          1.2203          0.3418          0.3155          0.1972   {txt}
{txt}1st Stage F-Stat    {res}     13526.11        10812.81        13526.11        13526.11        13526.11   {txt}
{txt}Fixed Effects       {res}          Yes             Yes             Yes             Yes             Yes   {txt}
{txt}Observations        {res}      502,546         438,736         502,546         502,546         502,546   {txt}
{txt}{hline 100}

{com}. 
. * Latex Output
. esttab using output\tables\table4b.tex, replace ///
> b(%5.4f) se(%5.4f) star(* 0.1 ** 0.05 *** 0.01) par depvars label collabels(none) ar2 ///
> s(lhsmean lhssd fstat fes N, ///
> label("Mean(dep. var.)" "SD(dep. var.)" "1st Stage F-Stat" "Fixed Effects" "Observations") ///
> fmt(4 4 2 0 %9.0fc)) nonotes booktabs // bottom summary
{res}{txt}(output written to {browse  `"output\tables\table4b.tex"'})

{com}. 
. *--------------------------------------------------
. * Table 5 - Effect on bankruptcies
. *--------------------------------------------------
. 
. * Effect on Chapter 7 bankruptcy rates at various horizons
. local iv "detained = $rivror"
{txt}
{com}. local tsfilters "inrange(year_init,2000,2008)"
{txt}
{com}. eststo clear
{txt}
{com}. local lhsv "zbankrupt7"
{txt}
{com}. local lhsvars "`lhsv'_2yrpre `lhsv'_1yrpre `lhsv'_6mospre `lhsv'_3mospre `lhsv'_3mos `lhsv'_6mos `lhsv'_1yr `lhsv'_2yr `lhsv'_3yr"
{txt}
{com}. foreach lhsvar of varlist `lhsvars' {c -(}
{txt}  2{com}.         eststo `lhsvar': quietly ivreghdfe `lhsvar' (`iv') if `tsfilters' & $xsfilters, absorb($fevars) cluster($ivclustvar) ffirst
{txt}  3{com}.         matrix firstmat = e(first) // First-stage statistics
{txt}  4{com}.         quietly estadd scalar fstat = firstmat[4,1] // Store first-stage F-stat 
{txt}  5{com}.         quietly estadd local fes "Yes"
{txt}  6{com}.         quietly sum `lhsvar' if e(sample)
{txt}  7{com}.         quietly estadd scalar lhsmean = r(mean)
{txt}  8{com}.         quietly estadd scalar lhssd = r(sd)
{txt}  9{com}. {c )-}
{txt}
{com}. esttab *_?mos *_?yr, b(%5.4f) se(%5.4f) star(* 0.1 ** 0.05 *** 0.01) par depvars label collabels(none) ar2 noconstant ///
> s(lhsmean lhssd fstat fes N, ///
> label("Mean(dep. var.)" "SD(dep. var.)" "1st Stage F-Stat" "Fixed Effects" "Observations") ///
> fmt(4 4 2 0 %9.0fc)) nonotes // bottom summary
{res}
{txt}{hline 100}
{txt}                              (1)             (2)             (3)             (4)             (5)   
{txt}                         3 Months        6 Months          1 Year         2 Years         3 Years   
{txt}{hline 100}
{txt}Detained            {res}       0.0003          0.0005          0.0044**        0.0076**        0.0079** {txt}
                    {res} {ralign 12:{txt:(}0.0013{txt:)}}    {ralign 12:{txt:(}0.0015{txt:)}}    {ralign 12:{txt:(}0.0021{txt:)}}    {ralign 12:{txt:(}0.0031{txt:)}}    {ralign 12:{txt:(}0.0037{txt:)}}   {txt}
{txt}{hline 100}
{txt}Mean(dep. var.)     {res}       0.0029          0.0057          0.0110          0.0198          0.0265   {txt}
{txt}SD(dep. var.)       {res}       0.0538          0.0755          0.1041          0.1393          0.1606   {txt}
{txt}1st Stage F-Stat    {res}     10004.82        10004.82        10004.82        10004.82        10004.82   {txt}
{txt}Fixed Effects       {res}          Yes             Yes             Yes             Yes             Yes   {txt}
{txt}Observations        {res}      306,722         306,722         306,722         306,722         306,722   {txt}
{txt}{hline 100}

{com}. 
. * Table 5a output
. esttab *_?mos *_?yr using output\tables\table5a.tex, replace ///
> b(%5.4f) se(%5.4f) star(* 0.1 ** 0.05 *** 0.01) par depvars label collabels(none) ar2 ///
> s(lhsmean lhssd fstat fes N, ///
> label("Mean(dep. var.)" "SD(dep. var.)" "1st Stage F-Stat" "Fixed Effects" "Observations") ///
> fmt(4 4 2 0 %9.0fc)) nonotes booktabs // bottom summary
{res}{txt}(output written to {browse  `"output\tables\table5a.tex"'})

{com}. 
. * Figure 4a
. local lhsvar zbankrupt7
{txt}
{com}. coefplot (`lhsvar'_2yrpre, aseq(-2 years) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_1yrpre, aseq(-1 year) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_6mospre, aseq(-6 months) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_3mospre, aseq(-3 months) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_3mos, aseq(3 months) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_6mos, aseq(6 months) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_1yr, aseq(1 year) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_2yr, aseq(2 years) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_3yr, aseq(3 years) mcolor(navy) ciopts(color(navy))), ///
> ytitle(Coefficient and 95% C.I. for Detained) xtitle(Bankruptcy Horizon) ///
> keep(detained) vertical aseq swapnames yline(0) xline(4.5) legend(off) xlabel(, angle(45))
{res}{txt}
{com}. graph export output\figures\figure4a.png, replace
{txt}(note: file output\figures\figure4a.png not found)
(file output\figures\figure4a.png written in PNG format)

{com}. 
. * Effect on Chapter 13 bankruptcy rates at various horizons
. local iv "detained = $rivror"
{txt}
{com}. local tsfilters "inrange(year_init,2000,2008)"
{txt}
{com}. eststo clear
{txt}
{com}. local lhsv "zbankrupt13"
{txt}
{com}. local lhsvars "`lhsv'_2yrpre `lhsv'_1yrpre `lhsv'_6mospre `lhsv'_3mospre `lhsv'_3mos `lhsv'_6mos `lhsv'_1yr `lhsv'_2yr `lhsv'_3yr"
{txt}
{com}. foreach lhsvar of varlist `lhsvars' {c -(}
{txt}  2{com}.         eststo `lhsvar': quietly ivreghdfe `lhsvar' (`iv') if `tsfilters' & $xsfilters, absorb($fevars) cluster($ivclustvar) ffirst
{txt}  3{com}.         matrix firstmat = e(first) // First-stage statistics
{txt}  4{com}.         quietly estadd scalar fstat = firstmat[4,1] // Store first-stage F-stat 
{txt}  5{com}.         quietly estadd local fes "Yes"
{txt}  6{com}.         quietly sum `lhsvar' if e(sample)
{txt}  7{com}.         quietly estadd scalar lhsmean = r(mean)
{txt}  8{com}.         quietly estadd scalar lhssd = r(sd)
{txt}  9{com}. {c )-}
{txt}
{com}. esttab *_?mos *_?yr, b(%5.4f) se(%5.4f) star(* 0.1 ** 0.05 *** 0.01) par depvars label collabels(none) ar2 noconstant ///
> s(lhsmean lhssd fstat fes N, ///
> label("Mean(dep. var.)" "SD(dep. var.)" "1st Stage F-Stat" "Fixed Effects" "Observations") ///
> fmt(4 4 2 0 %9.0fc)) nonotes // bottom summary
{res}
{txt}{hline 100}
{txt}                              (1)             (2)             (3)             (4)             (5)   
{txt}                         3 Months        6 Months          1 Year         2 Years         3 Years   
{txt}{hline 100}
{txt}Detained            {res}      -0.0015          0.0002         -0.0010         -0.0001         -0.0002   {txt}
                    {res} {ralign 12:{txt:(}0.0011{txt:)}}    {ralign 12:{txt:(}0.0017{txt:)}}    {ralign 12:{txt:(}0.0017{txt:)}}    {ralign 12:{txt:(}0.0025{txt:)}}    {ralign 12:{txt:(}0.0035{txt:)}}   {txt}
{txt}{hline 100}
{txt}Mean(dep. var.)     {res}       0.0022          0.0042          0.0077          0.0128          0.0160   {txt}
{txt}SD(dep. var.)       {res}       0.0469          0.0644          0.0874          0.1122          0.1254   {txt}
{txt}1st Stage F-Stat    {res}     10004.82        10004.82        10004.82        10004.82        10004.82   {txt}
{txt}Fixed Effects       {res}          Yes             Yes             Yes             Yes             Yes   {txt}
{txt}Observations        {res}      306,722         306,722         306,722         306,722         306,722   {txt}
{txt}{hline 100}

{com}. 
. * Table 5b output
. esttab *_?mos *_?yr using output\tables\table5b.tex, replace ///
> b(%5.4f) se(%5.4f) star(* 0.1 ** 0.05 *** 0.01) par depvars label collabels(none) ar2 ///
> s(lhsmean lhssd fstat fes N, ///
> label("Mean(dep. var.)" "SD(dep. var.)" "1st Stage F-Stat" "Fixed Effects" "Observations") ///
> fmt(4 4 2 0 %9.0fc)) nonotes booktabs // bottom summary
{res}{txt}(note: file output\tables\table5b.tex not found)
(output written to {browse  `"output\tables\table5b.tex"'})

{com}. 
. * Figure 4b
. local lhsvar zbankrupt13
{txt}
{com}. coefplot (`lhsvar'_2yrpre, aseq(-2 years) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_1yrpre, aseq(-1 year) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_6mospre, aseq(-6 months) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_3mospre, aseq(-3 months) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_3mos, aseq(3 months) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_6mos, aseq(6 months) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_1yr, aseq(1 year) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_2yr, aseq(2 years) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_3yr, aseq(3 years) mcolor(navy) ciopts(color(navy))), ///
> ytitle(Coefficient and 95% C.I. for Detained) xtitle(Bankruptcy Horizon) ///
> keep(detained) vertical aseq swapnames yline(0) xline(4.5) legend(off) xlabel(, angle(45))
{res}{txt}
{com}. graph export output\figures\figure4b.png, replace
{txt}(note: file output\figures\figure4b.png not found)
(file output\figures\figure4b.png written in PNG format)

{com}. 
. 
. *--------------------------------------------------
. * Table 6 - Effect on judgment liens
. *--------------------------------------------------
. 
. * Effect on judgment liens
. local iv "detained = $rivror"
{txt}
{com}. eststo clear
{txt}
{com}. local lhsv "zlien"
{txt}
{com}. local lhsvars "`lhsv'_2yrpre `lhsv'_1yrpre `lhsv'_6mospre `lhsv'_3mospre `lhsv'_3mos `lhsv'_6mos `lhsv'_1yr `lhsv'_2yr `lhsv'_3yr"
{txt}
{com}. foreach lhsvar of varlist `lhsvars' {c -(}
{txt}  2{com}.         eststo `lhsvar': quietly ivreghdfe `lhsvar' (`iv') if $tsfilters & $xsfilters, absorb($fevars) cluster($ivclustvar) ffirst
{txt}  3{com}.         matrix firstmat = e(first) // First-stage statistics
{txt}  4{com}.         quietly estadd scalar fstat = firstmat[4,1] // Store first-stage F-stat 
{txt}  5{com}.         quietly estadd local fes "Yes"
{txt}  6{com}.         quietly sum `lhsvar' if e(sample)
{txt}  7{com}.         quietly estadd scalar lhsmean = r(mean)
{txt}  8{com}.         quietly estadd scalar lhssd = r(sd)
{txt}  9{com}. {c )-}
{txt}
{com}. esttab *_?mos *_?yr, b(%5.4f) se(%5.4f) star(* 0.1 ** 0.05 *** 0.01) par depvars label collabels(none) ar2 noconstant ///
> s(lhsmean lhssd fstat fes N, ///
> label("Mean(dep. var.)" "SD(dep. var.)" "1st Stage F-Stat" "Fixed Effects" "Observations") ///
> fmt(4 4 2 0 %9.0fc)) nonotes // bottom summary
{res}
{txt}{hline 100}
{txt}                              (1)             (2)             (3)             (4)             (5)   
{txt}                         3 Months        6 Months          1 Year         2 Years         3 Years   
{txt}{hline 100}
{txt}Detained            {res}      -0.0005         -0.0005          0.0004          0.0026          0.0056** {txt}
                    {res} {ralign 12:{txt:(}0.0008{txt:)}}    {ralign 12:{txt:(}0.0013{txt:)}}    {ralign 12:{txt:(}0.0017{txt:)}}    {ralign 12:{txt:(}0.0021{txt:)}}    {ralign 12:{txt:(}0.0023{txt:)}}   {txt}
{txt}{hline 100}
{txt}Mean(dep. var.)     {res}       0.0018          0.0042          0.0082          0.0127          0.0161   {txt}
{txt}SD(dep. var.)       {res}       0.0424          0.0646          0.0900          0.1122          0.1260   {txt}
{txt}1st Stage F-Stat    {res}     13526.11        13526.11        13526.11        13526.11        13526.11   {txt}
{txt}Fixed Effects       {res}          Yes             Yes             Yes             Yes             Yes   {txt}
{txt}Observations        {res}      502,546         502,546         502,546         502,546         502,546   {txt}
{txt}{hline 100}

{com}. 
. * Table 6 output
. esttab *_?mos *_?yr using output\tables\table6.tex, replace ///
> b(%5.4f) se(%5.4f) star(* 0.1 ** 0.05 *** 0.01) par depvars label collabels(none) ar2 ///
> s(lhsmean lhssd fstat fes N, ///
> label("Mean(dep. var.)" "SD(dep. var.)" "1st Stage F-Stat" "Fixed Effects" "Observations") ///
> fmt(4 4 2 0 %9.0fc)) nonotes booktabs // bottom summary
{res}{txt}(output written to {browse  `"output\tables\table6.tex"'})

{com}. 
. * Figure 5
. local lhsvar zlien
{txt}
{com}. coefplot (`lhsvar'_2yrpre, aseq(-2 years) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_1yrpre, aseq(-1 year) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_6mospre, aseq(-6 months) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_3mospre, aseq(-3 months) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_3mos, aseq(3 months) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_6mos, aseq(6 months) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_1yr, aseq(1 year) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_2yr, aseq(2 years) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_3yr, aseq(3 years) mcolor(navy) ciopts(color(navy))), ///
> ytitle(Coefficient and 95% C.I. for Detained) xtitle(Judgment Horizon) ///
> keep(detained) vertical aseq swapnames yline(0) xline(4.5) legend(off) xlabel(, angle(45))
{res}{txt}
{com}. graph export output\figures\figure5.png, replace
{txt}(note: file output\figures\figure5.png not found)
(file output\figures\figure5.png written in PNG format)

{com}. 
. *--------------------------------------------------
. * Table 7 - Effect on foreclosures
. *--------------------------------------------------
. 
. * Effect on foreclosures (full sample period)
. local iv "detained = $rivror"
{txt}
{com}. local xsfilters  "!isapt & !missing(pretsctdate) & numcases_percommyr>50"
{txt}
{com}. eststo clear
{txt}
{com}. local lhsv "zfcl"
{txt}
{com}. local lhsvars "`lhsv'_2yrpre `lhsv'_1yrpre `lhsv'_6mospre `lhsv'_3mospre `lhsv'_3mos `lhsv'_6mos `lhsv'_1yr `lhsv'_2yr `lhsv'_3yr"
{txt}
{com}. foreach lhsvar of varlist `lhsvars' {c -(}
{txt}  2{com}.         eststo `lhsvar': quietly ivreghdfe `lhsvar' (`iv') if $tsfilters & `xsfilters', absorb($fevars) cluster($ivclustvar) ffirst
{txt}  3{com}.         matrix firstmat = e(first) // First-stage statistics
{txt}  4{com}.         quietly estadd scalar fstat = firstmat[4,1] // Store first-stage F-stat 
{txt}  5{com}.         quietly estadd local fes "Yes"
{txt}  6{com}.         quietly sum `lhsvar' if e(sample)
{txt}  7{com}.         quietly estadd scalar lhsmean = r(mean)
{txt}  8{com}.         quietly estadd scalar lhssd = r(sd)
{txt}  9{com}. {c )-}
{txt}
{com}. esttab *_?mos *_?yr, b(%5.4f) se(%5.4f) star(* 0.1 ** 0.05 *** 0.01) par depvars label collabels(none) ar2 noconstant ///
> s(lhsmean lhssd fstat fes N, ///
> label("Mean(dep. var.)" "SD(dep. var.)" "1st Stage F-Stat" "Fixed Effects" "Observations") ///
> fmt(4 4 2 0 %9.0fc)) nonotes // bottom summary
{res}
{txt}{hline 100}
{txt}                              (1)             (2)             (3)             (4)             (5)   
{txt}                         3 Months        6 Months          1 Year         2 Years         3 Years   
{txt}{hline 100}
{txt}Detained            {res}       0.0015          0.0017          0.0007          0.0042          0.0092   {txt}
                    {res} {ralign 12:{txt:(}0.0028{txt:)}}    {ralign 12:{txt:(}0.0037{txt:)}}    {ralign 12:{txt:(}0.0052{txt:)}}    {ralign 12:{txt:(}0.0066{txt:)}}    {ralign 12:{txt:(}0.0074{txt:)}}   {txt}
{txt}{hline 100}
{txt}Mean(dep. var.)     {res}       0.0103          0.0200          0.0384          0.0688          0.0931   {txt}
{txt}SD(dep. var.)       {res}       0.1008          0.1400          0.1922          0.2532          0.2906   {txt}
{txt}1st Stage F-Stat    {res}      6305.53         6305.53         6305.53         6305.53         6305.53   {txt}
{txt}Fixed Effects       {res}          Yes             Yes             Yes             Yes             Yes   {txt}
{txt}Observations        {res}      275,325         275,325         275,325         275,325         275,325   {txt}
{txt}{hline 100}

{com}. 
. * Table 7A output
. esttab *_?mos *_?yr using output\tables\table7a.tex, replace ///
> b(%5.4f) se(%5.4f) star(* 0.1 ** 0.05 *** 0.01) par depvars label collabels(none) ar2 ///
> s(lhsmean lhssd fstat fes N, ///
> label("Mean(dep. var.)" "SD(dep. var.)" "1st Stage F-Stat" "Fixed Effects" "Observations") ///
> fmt(4 4 2 0 %9.0fc)) nonotes booktabs // bottom summary
{res}{txt}(output written to {browse  `"output\tables\table7a.tex"'})

{com}. 
. * Figure 7a output
. local lhsvar zfcl
{txt}
{com}. coefplot (`lhsvar'_2yrpre, aseq(-2 years) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_1yrpre, aseq(-1 year) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_6mospre, aseq(-6 months) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_3mospre, aseq(-3 months) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_3mos, aseq(3 months) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_6mos, aseq(6 months) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_1yr, aseq(1 year) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_2yr, aseq(2 years) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_3yr, aseq(3 years) mcolor(navy) ciopts(color(navy))), ///
> ytitle(Coefficient and 95% C.I. for Detained) xtitle(Foreclosure Horizon) ///
> keep(detained) vertical aseq swapnames yline(0) xline(4.5) legend(off) xlabel(, angle(45))
{res}{txt}
{com}. graph export output\figures\figure7a.png, replace
{txt}(note: file output\figures\figure7a.png not found)
(file output\figures\figure7a.png written in PNG format)

{com}. 
. * Effect on foreclosures (negative HPI growth)
. local iv "detained = $rivror"
{txt}
{com}. local xsfilters  "!isapt & !missing(pretsctdate) & numcases_percommyr>50"
{txt}
{com}. local addfilter "neg_hpichange==1"
{txt}
{com}. eststo clear
{txt}
{com}. local lhsv "zfcl"
{txt}
{com}. local lhsvars "`lhsv'_2yrpre `lhsv'_1yrpre `lhsv'_6mospre `lhsv'_3mospre `lhsv'_3mos `lhsv'_6mos `lhsv'_1yr `lhsv'_2yr `lhsv'_3yr"
{txt}
{com}. foreach lhsvar of varlist `lhsvars' {c -(}
{txt}  2{com}.         eststo `lhsvar': quietly ivreghdfe `lhsvar' (`iv') if $tsfilters & `xsfilters' & `addfilter', absorb($fevars) cluster($ivclustvar) ffirst
{txt}  3{com}.         matrix firstmat = e(first) // First-stage statistics
{txt}  4{com}.         quietly estadd scalar fstat = firstmat[4,1] // Store first-stage F-stat 
{txt}  5{com}.         quietly estadd local fes "Yes"
{txt}  6{com}.         quietly sum `lhsvar' if e(sample)
{txt}  7{com}.         quietly estadd scalar lhsmean = r(mean)
{txt}  8{com}.         quietly estadd scalar lhssd = r(sd)
{txt}  9{com}. {c )-}
{txt}
{com}. esttab *_?mos *_?yr, b(%5.4f) se(%5.4f) star(* 0.1 ** 0.05 *** 0.01) par depvars label collabels(none) ar2 noconstant ///
> s(lhsmean lhssd fstat fes N, ///
> label("Mean(dep. var.)" "SD(dep. var.)" "1st Stage F-Stat" "Fixed Effects" "Observations") ///
> fmt(4 4 2 0 %9.0fc)) nonotes // bottom summary
{res}
{txt}{hline 100}
{txt}                              (1)             (2)             (3)             (4)             (5)   
{txt}                         3 Months        6 Months          1 Year         2 Years         3 Years   
{txt}{hline 100}
{txt}Detained            {res}       0.0003          0.0053          0.0199**        0.0243**        0.0291** {txt}
                    {res} {ralign 12:{txt:(}0.0048{txt:)}}    {ralign 12:{txt:(}0.0067{txt:)}}    {ralign 12:{txt:(}0.0089{txt:)}}    {ralign 12:{txt:(}0.0111{txt:)}}    {ralign 12:{txt:(}0.0123{txt:)}}   {txt}
{txt}{hline 100}
{txt}Mean(dep. var.)     {res}       0.0113          0.0221          0.0457          0.0881          0.1238   {txt}
{txt}SD(dep. var.)       {res}       0.1058          0.1471          0.2088          0.2835          0.3294   {txt}
{txt}1st Stage F-Stat    {res}      3796.09         3796.09         3796.09         3796.09         3796.09   {txt}
{txt}Fixed Effects       {res}          Yes             Yes             Yes             Yes             Yes   {txt}
{txt}Observations        {res}      107,357         107,357         107,357         107,357         107,357   {txt}
{txt}{hline 100}

{com}. 
. * Table 7B output
. esttab *_?mos *_?yr using output\tables\table7b.tex, replace ///
> b(%5.4f) se(%5.4f) star(* 0.1 ** 0.05 *** 0.01) par depvars label collabels(none) ar2 ///
> s(lhsmean lhssd fstat fes N, ///
> label("Mean(dep. var.)" "SD(dep. var.)" "1st Stage F-Stat" "Fixed Effects" "Observations") ///
> fmt(4 4 2 0 %9.0fc)) nonotes booktabs // bottom summary
{res}{txt}(output written to {browse  `"output\tables\table7b.tex"'})

{com}. 
. * Figure 7b
. local lhsvar zfcl
{txt}
{com}. coefplot (`lhsvar'_2yrpre, aseq(-2 years) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_1yrpre, aseq(-1 year) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_6mospre, aseq(-6 months) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_3mospre, aseq(-3 months) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_3mos, aseq(3 months) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_6mos, aseq(6 months) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_1yr, aseq(1 year) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_2yr, aseq(2 years) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_3yr, aseq(3 years) mcolor(navy) ciopts(color(navy))), ///
> ytitle(Coefficient and 95% C.I. for Detained) xtitle(Foreclosure Horizon) ///
> keep(detained) vertical aseq swapnames yline(0) xline(4.5) legend(off) xlabel(, angle(45))
{res}{txt}
{com}. graph export output\figures\figure7b.png, replace
{txt}(note: file output\figures\figure7b.png not found)
(file output\figures\figure7b.png written in PNG format)

{com}. 
. 
. * Effect on foreclosures (positive HPI growth)
. local iv "detained = $rivror"
{txt}
{com}. local xsfilters  "!isapt & !missing(pretsctdate) & numcases_percommyr>50"
{txt}
{com}. local addfilter "neg_hpichange==0"
{txt}
{com}. eststo clear
{txt}
{com}. local lhsv "zfcl"
{txt}
{com}. local lhsvars "`lhsv'_2yrpre `lhsv'_1yrpre `lhsv'_6mospre `lhsv'_3mospre `lhsv'_3mos `lhsv'_6mos `lhsv'_1yr `lhsv'_2yr `lhsv'_3yr"
{txt}
{com}. foreach lhsvar of varlist `lhsvars' {c -(}
{txt}  2{com}.         eststo `lhsvar': quietly ivreghdfe `lhsvar' (`iv') if $tsfilters & `xsfilters' & `addfilter', absorb($fevars) cluster($ivclustvar) ffirst
{txt}  3{com}.         matrix firstmat = e(first) // First-stage statistics
{txt}  4{com}.         quietly estadd scalar fstat = firstmat[4,1] // Store first-stage F-stat 
{txt}  5{com}.         quietly estadd local fes "Yes"
{txt}  6{com}.         quietly sum `lhsvar' if e(sample)
{txt}  7{com}.         quietly estadd scalar lhsmean = r(mean)
{txt}  8{com}.         quietly estadd scalar lhssd = r(sd)
{txt}  9{com}. {c )-}
{txt}
{com}. esttab *_?mos *_?yr, b(%5.4f) se(%5.4f) star(* 0.1 ** 0.05 *** 0.01) par depvars label collabels(none) ar2 noconstant ///
> s(lhsmean lhssd fstat fes N, ///
> label("Mean(dep. var.)" "SD(dep. var.)" "1st Stage F-Stat" "Fixed Effects" "Observations") ///
> fmt(4 4 2 0 %9.0fc)) nonotes // bottom summary
{res}
{txt}{hline 100}
{txt}                              (1)             (2)             (3)             (4)             (5)   
{txt}                         3 Months        6 Months          1 Year         2 Years         3 Years   
{txt}{hline 100}
{txt}Detained            {res}       0.0022         -0.0006         -0.0113*        -0.0082         -0.0033   {txt}
                    {res} {ralign 12:{txt:(}0.0032{txt:)}}    {ralign 12:{txt:(}0.0043{txt:)}}    {ralign 12:{txt:(}0.0062{txt:)}}    {ralign 12:{txt:(}0.0077{txt:)}}    {ralign 12:{txt:(}0.0089{txt:)}}   {txt}
{txt}{hline 100}
{txt}Mean(dep. var.)     {res}       0.0095          0.0185          0.0336          0.0563          0.0733   {txt}
{txt}SD(dep. var.)       {res}       0.0970          0.1348          0.1801          0.2304          0.2606   {txt}
{txt}1st Stage F-Stat    {res}      4141.66         4141.66         4141.66         4141.66         4141.66   {txt}
{txt}Fixed Effects       {res}          Yes             Yes             Yes             Yes             Yes   {txt}
{txt}Observations        {res}      166,155         166,155         166,155         166,155         166,155   {txt}
{txt}{hline 100}

{com}. 
. * Table 7C output
. esttab *_?mos *_?yr using output\tables\table7c.tex, replace ///
> b(%5.4f) se(%5.4f) star(* 0.1 ** 0.05 *** 0.01) par depvars label collabels(none) ar2 ///
> s(lhsmean lhssd fstat fes N, ///
> label("Mean(dep. var.)" "SD(dep. var.)" "1st Stage F-Stat" "Fixed Effects" "Observations") ///
> fmt(4 4 2 0 %9.0fc)) nonotes booktabs // bottom summary
{res}{txt}(output written to {browse  `"output\tables\table7c.tex"'})

{com}. 
. * Figure 7c
. local lhsvar zfcl
{txt}
{com}. coefplot (`lhsvar'_2yrpre, aseq(-2 years) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_1yrpre, aseq(-1 year) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_6mospre, aseq(-6 months) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_3mospre, aseq(-3 months) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_3mos, aseq(3 months) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_6mos, aseq(6 months) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_1yr, aseq(1 year) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_2yr, aseq(2 years) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_3yr, aseq(3 years) mcolor(navy) ciopts(color(navy))), ///
> ytitle(Coefficient and 95% C.I. for Detained) xtitle(Foreclosure Horizon) ///
> keep(detained) vertical aseq swapnames yline(0) xline(4.5) legend(off) xlabel(, angle(45))
{res}{txt}
{com}. graph export output\figures\figure7c.png, replace
{txt}(note: file output\figures\figure7c.png not found)
(file output\figures\figure7c.png written in PNG format)

{com}. 
. *--------------------------------------------------
. * Table 8 - Effect on overall insolvency
. *--------------------------------------------------
. 
. * Effect on overall insolvency
. eststo clear
{txt}
{com}. local iv "detained = $rivror"
{txt}
{com}. local lhsv "zinsolvent"
{txt}
{com}. local lhsvars "`lhsv'_2yrpre `lhsv'_1yrpre `lhsv'_6mospre `lhsv'_3mospre `lhsv'_3mos `lhsv'_6mos `lhsv'_1yr `lhsv'_2yr `lhsv'_3yr"
{txt}
{com}. foreach lhsvar of varlist `lhsvars' {c -(}
{txt}  2{com}.         eststo `lhsvar': quietly ivreghdfe `lhsvar' (`iv') `ctrlvars' if $tsfilters & $zfilters, absorb($fevars) cluster($ivclustvar) ffirst
{txt}  3{com}.         matrix firstmat = e(first) // First-stage statistics
{txt}  4{com}.         quietly estadd scalar fstat = firstmat[4,1] // Store first-stage F-stat 
{txt}  5{com}.         quietly estadd local fes "Yes"
{txt}  6{com}.         quietly sum `lhsvar' if e(sample)
{txt}  7{com}.         quietly estadd scalar lhsmean = r(mean)
{txt}  8{com}.         quietly estadd scalar lhssd = r(sd)
{txt}  9{com}. {c )-}
{txt}
{com}. esttab *_?mos *_?yr, b(%5.4f) se(%5.4f) star(* 0.1 ** 0.05 *** 0.01) par depvars label collabels(none) ar2 ///
> s(lhsmean lhssd fstat fes N, ///
> label("Mean(dep. var.)" "SD(dep. var.)" "1st Stage F-Stat" "Fixed Effects" "Observations") ///
> fmt(4 4 2 0 %9.0fc)) nonotes // bottom summary
{res}
{txt}{hline 100}
{txt}                              (1)             (2)             (3)             (4)             (5)   
{txt}                         3 Months        6 Months          1 Year         2 Years         3 Years   
{txt}{hline 100}
{txt}Detained            {res}       0.0038          0.0059          0.0063          0.0177**        0.0242***{txt}
                    {res} {ralign 12:{txt:(}0.0036{txt:)}}    {ralign 12:{txt:(}0.0047{txt:)}}    {ralign 12:{txt:(}0.0065{txt:)}}    {ralign 12:{txt:(}0.0077{txt:)}}    {ralign 12:{txt:(}0.0090{txt:)}}   {txt}
{txt}{hline 100}
{txt}Mean(dep. var.)     {res}       0.0180          0.0357          0.0674          0.1137          0.1479   {txt}
{txt}SD(dep. var.)       {res}       0.1331          0.1856          0.2507          0.3175          0.3550   {txt}
{txt}1st Stage F-Stat    {res}      6305.53         6305.53         6305.53         6305.53         6305.53   {txt}
{txt}Fixed Effects       {res}          Yes             Yes             Yes             Yes             Yes   {txt}
{txt}Observations        {res}      275,325         275,325         275,325         275,325         275,325   {txt}
{txt}{hline 100}

{com}. 
. * Table 8 output
. esttab *_?mos *_?yr using output\tables\table8.tex, replace ///
> b(%5.4f) se(%5.4f) star(* 0.1 ** 0.05 *** 0.01) par depvars label collabels(none) ar2 ///
> s(lhsmean lhssd fstat fes N, ///
> label("Mean(dep. var.)" "SD(dep. var.)" "1st Stage F-Stat" "Fixed Effects" "Observations") ///
> fmt(4 4 2 0 %9.0fc)) nonotes booktabs // bottom summary
{res}{txt}(output written to {browse  `"output\tables\table8.tex"'})

{com}. 
. * Figure 8 output
. local lhsvar zinsolvent
{txt}
{com}. coefplot (`lhsvar'_2yrpre, aseq(-2 years) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_1yrpre, aseq(-1 year) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_6mospre, aseq(-6 months) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_3mospre, aseq(-3 months) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_3mos, aseq(3 months) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_6mos, aseq(6 months) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_1yr, aseq(1 year) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_2yr, aseq(2 years) mcolor(navy) ciopts(color(navy))) ///
> (`lhsvar'_3yr, aseq(3 years) mcolor(navy) ciopts(color(navy))), ///
> ytitle(Coefficient and 95% C.I. for Detained) xtitle(Insolvency Horizon) ///
> keep(detained) vertical aseq swapnames yline(0) xline(4.5) legend(off) xlabel(, angle(45))
{res}{txt}
{com}. graph export output\figures\figure8.png, replace
{txt}(note: file output\figures\figure8.png not found)
(file output\figures\figure8.png written in PNG format)

{com}. 
. *--------------------------------------------------
. * Table 9 - Effect on name-matched insolvencies
. *--------------------------------------------------
. 
. * Label variables
. label variable zinsolvent_dmf_3yr "InsolventDef"
{txt}
{com}. label variable zinsolvent_fmf_3yr "InsolventFamily"
{txt}
{com}. label variable zinsolvent_nml_3yr "InsolventName"
{txt}
{com}. label variable zinsolvent_ndl_3yr "InsolventUnrelated"
{txt}
{com}. 
. * Effect on name-matched insolvencies
. eststo clear
{txt}
{com}. local iv "detained = $rivror"
{txt}
{com}. local lhsv "zinsolvent"
{txt}
{com}. foreach lhsvar of varlist `lhsv'_dmf_3yr `lhsv'_fmf_3yr `lhsv'_nml_3yr `lhsv'_ndl_3yr {c -(}
{txt}  2{com}.         eststo `lhsvar': quietly ivreghdfe `lhsvar' (`iv') if $tsfilters & $zfilters, absorb($fevars) cluster($ivclustvar) ffirst
{txt}  3{com}.         matrix firstmat = e(first) // First-stage statistics
{txt}  4{com}.         quietly estadd scalar fstat = firstmat[4,1] // Store first-stage F-stat 
{txt}  5{com}.         quietly estadd local fes "Yes"
{txt}  6{com}.         quietly sum `lhsvar' if e(sample)
{txt}  7{com}.         quietly estadd scalar lhsmean = r(mean)
{txt}  8{com}.         quietly estadd scalar lhssd = r(sd)
{txt}  9{com}.         
. {c )-}
{txt}
{com}. esttab, b(%5.4f) se(%5.4f) star(* 0.1 ** 0.05 *** 0.01) par depvars label collabels(none) ar2 ///
> keep(detained) s(lhsmean lhssd fstat fes N, ///
> label("Mean(dep. var.)" "SD(dep. var.)" "1st Stage F-Stat" "Fixed Effects" "Observations") ///
> fmt(4 4 2 0 %9.0fc)) nonotes // bottom summary
{res}
{txt}{hline 84}
{txt}                              (1)             (2)             (3)             (4)   
{txt}                     InsolventDef    InsolventF~y    InsolventN~e    InsolventU~d   
{txt}{hline 84}
{txt}Detained            {res}       0.0027          0.0075**        0.0119**        0.0123   {txt}
                    {res} {ralign 12:{txt:(}0.0031{txt:)}}    {ralign 12:{txt:(}0.0038{txt:)}}    {ralign 12:{txt:(}0.0048{txt:)}}    {ralign 12:{txt:(}0.0082{txt:)}}   {txt}
{txt}{hline 84}
{txt}Mean(dep. var.)     {res}       0.0160          0.0336          0.0491          0.0987   {txt}
{txt}SD(dep. var.)       {res}       0.1256          0.1802          0.2161          0.2983   {txt}
{txt}1st Stage F-Stat    {res}      6305.53         6305.53         6305.53         6305.53   {txt}
{txt}Fixed Effects       {res}          Yes             Yes             Yes             Yes   {txt}
{txt}Observations        {res}      275,325         275,325         275,325         275,325   {txt}
{txt}{hline 84}

{com}. 
. * Table 9 output
. esttab using output\tables\table9.tex, replace ///
> b(%5.4f) se(%5.4f) star(* 0.1 ** 0.05 *** 0.01) par depvars label collabels(none) ar2 ///
> keep(detained) s(lhsmean lhssd fstat fes N, ///
> label("Mean(dep. var.)" "SD(dep. var.)" "1st Stage F-Stat" "Fixed Effects" "Observations") ///
> fmt(4 4 2 0 %9.0fc)) nonotes booktabs // bottom summary
{res}{txt}(output written to {browse  `"output\tables\table9.tex"'})

{com}. 
. *--------------------------------------------------------
. * Table 10 - commercial bond mechanism subsample tests
. *--------------------------------------------------------
. 
. * Relabel LHS variable
. label variable zinsolvent_3yr "Insolvent"
{txt}
{com}. 
. * Heterogeneity in defendant characteristics - 2SLS
. local lhsvar "zinsolvent_3yr"
{txt}
{com}. local iv "detained = $rivror"
{txt}
{com}. local subfilter1 "(init_statusROR==1|bond_corp==1)"
{txt}
{com}. local subfilter2 "(init_statusROR==1|bond_corp==1) & timelyrelease1==1"
{txt}
{com}. local subfilter3 "(init_statusROR==1|bond_corp==1) & disposition_dismissal==1"
{txt}
{com}. local subfilter4 "(init_statusROR==1|bond_corp==1) & timelyrelease1==1 & disposition_dismissal==1"
{txt}
{com}. local subfilter5 "bond_corp==0"
{txt}
{com}. local corpbondfilter1 "No"
{txt}
{com}. local corpbondfilter2 "No"
{txt}
{com}. local corpbondfilter3 "No"
{txt}
{com}. local corpbondfilter4 "No"
{txt}
{com}. local corpbondfilter5 "Yes"
{txt}
{com}. local rorfilter1 "Yes"
{txt}
{com}. local rorfilter2 "Yes"
{txt}
{com}. local rorfilter3 "Yes"
{txt}
{com}. local rorfilter4 "Yes"
{txt}
{com}. local rorfilter5 "No"
{txt}
{com}. local timelyfilter1 "No"
{txt}
{com}. local timelyfilter2 "Yes"
{txt}
{com}. local timelyfilter3 "No"
{txt}
{com}. local timelyfilter4 "Yes"
{txt}
{com}. local timelyfilter5 "No"
{txt}
{com}. local dismissfilter1 "No"
{txt}
{com}. local dismissfilter2 "No"
{txt}
{com}. local dismissfilter3 "Yes"
{txt}
{com}. local dismissfilter4 "Yes"
{txt}
{com}. local dismissfilter5 "No"
{txt}
{com}. eststo clear
{txt}
{com}. forvalues i=1/5  {c -(}
{txt}  2{com}.         eststo model`i': quietly ivreghdfe `lhsvar' (`iv') if $tsfilters & $zfilters & `subfilter`i'', absorb($fevars) cluster($ivclustvar) ffirst
{txt}  3{com}.         matrix firstmat = e(first) // First-stage statistics
{txt}  4{com}.         quietly estadd scalar fstat = firstmat[4,1] // Store first-stage F-stat 
{txt}  5{com}.         quietly estadd local fes "Yes"
{txt}  6{com}.         quietly sum `lhsvar' if e(sample)
{txt}  7{com}.         quietly estadd scalar lhsmean = r(mean)
{txt}  8{com}.         quietly estadd scalar lhssd = r(sd)
{txt}  9{com}.         quietly estadd local corpbondfilterlab `corpbondfilter`i''
{txt} 10{com}.         quietly estadd local rorfilterlab `rorfilter`i''
{txt} 11{com}.         quietly estadd local timelyfilterlab `timelyfilter`i''
{txt} 12{com}.         quietly estadd local dismissfilterlab `dismissfilter`i''
{txt} 13{com}. {c )-}
{txt}
{com}. esttab, b(%5.4f) se(%5.4f) star(* 0.1 ** 0.05 *** 0.01) par label collabels(none) ar2 noconstant depvars ///
> s(rorfilterlab timelyfilterlab dismissfilterlab corpbondfilterlab lhsmean lhssd fstat fes N, ///
> label("Drop Non-Commercial Bond" "Timely Release Only" "Dismissed Cases Only" "Drop Commercial Bond" "Mean(dep. var.)" "SD(dep. var.)" "1st Stage F-Stat" "Fixed Effects" "Observations") ///
> fmt(0 0 0 0 4 4 2 0 %9.0fc)) nonotes // bottom summary
{res}
{txt}{hline 100}
{txt}                              (1)             (2)             (3)             (4)             (5)   
{txt}                        Insolvent       Insolvent       Insolvent       Insolvent       Insolvent   
{txt}{hline 100}
{txt}Detained            {res}       0.0422***       0.0506**        0.0414*         0.0639*         0.0196*  {txt}
                    {res} {ralign 12:{txt:(}0.0143{txt:)}}    {ralign 12:{txt:(}0.0225{txt:)}}    {ralign 12:{txt:(}0.0217{txt:)}}    {ralign 12:{txt:(}0.0364{txt:)}}    {ralign 12:{txt:(}0.0102{txt:)}}   {txt}
{txt}{hline 100}
{txt}Drop Non-Commercia~d{res}          Yes             Yes             Yes             Yes              No   {txt}
{txt}Timely Release Only {res}           No             Yes              No             Yes              No   {txt}
{txt}Dismissed Cases Only{res}           No              No             Yes             Yes              No   {txt}
{txt}Drop Commercial Bond{res}           No              No              No              No             Yes   {txt}
{txt}Mean(dep. var.)     {res}       0.1436          0.1429          0.1445          0.1443          0.1475   {txt}
{txt}SD(dep. var.)       {res}       0.3506          0.3500          0.3516          0.3514          0.3546   {txt}
{txt}1st Stage F-Stat    {res}       448.15          171.73          378.17          144.60         3220.57   {txt}
{txt}Fixed Effects       {res}          Yes             Yes             Yes             Yes             Yes   {txt}
{txt}Observations        {res}      162,896         143,327          77,244          69,437         229,728   {txt}
{txt}{hline 100}

{com}. 
. * Table 10 output
. esttab using output\tables\table10.tex, replace depvars ///
> b(%5.4f) se(%5.4f) star(* 0.1 ** 0.05 *** 0.01) par label collabels(none) ar2 ///
> s(rorfilterlab timelyfilterlab dismissfilterlab corpbondfilterlab lhsmean lhssd fstat fes N, ///
> label("Drop Non-Commercial Bond" "Timely Release Only" "Dismissed Cases Only" "Drop Commercial Bond" "Mean(dep. var.)" "SD(dep. var.)" "1st Stage F-Stat" "Fixed Effects" "Observations") ///
> fmt(0 0 0 0 4 4 2 0 %9.0fc)) nonotes booktabs // bottom summary
{res}{txt}(output written to {browse  `"output\tables\table10.tex"'})

{com}. 
. * Relabel
. label variable zinsolvent_3yr "3 Years"
{txt}
{com}. 
. *--------------------------------------------------
. * Table 11 - additional subsample tests
. *--------------------------------------------------
. 
. * Panel A - heterogeneity in defendant characteristics
. local lhsvar "zinsolvent_3yr"
{txt}
{com}. local iv "detained = $rivror"
{txt}
{com}. local subfilter1 "young==1"
{txt}
{com}. local subfilter2 "young==0"
{txt}
{com}. local subfilter3 "black==1"
{txt}
{com}. local subfilter4 "black==0"
{txt}
{com}. local subfilter5 "male==1"
{txt}
{com}. local subfilter6 "male==0"
{txt}
{com}. local subfilter7 "age_purchase_high==0"
{txt}
{com}. local subfilter8 "age_purchase_high==1"
{txt}
{com}. local subfilterlab1 "Young"
{txt}
{com}. local subfilterlab2 "Old"
{txt}
{com}. local subfilterlab3 "Black"
{txt}
{com}. local subfilterlab4 "NonBlack"
{txt}
{com}. local subfilterlab5 "Male"
{txt}
{com}. local subfilterlab6 "Female"
{txt}
{com}. local subfilterlab7 "YoungPurchase"
{txt}
{com}. local subfilterlab8 "OldPurchase"
{txt}
{com}. eststo clear
{txt}
{com}. forvalues i=1/8  {c -(}
{txt}  2{com}.         eststo `subfilterlab`i'': quietly ivreghdfe `lhsvar' (`iv') if $tsfilters & $zfilters & `subfilter`i'', absorb($fevars) cluster($ivclustvar) ffirst
{txt}  3{com}.         matrix firstmat = e(first) // First-stage statistics
{txt}  4{com}.         quietly estadd scalar fstat = firstmat[4,1] // Store first-stage F-stat 
{txt}  5{com}.         quietly estadd local fes "Yes"
{txt}  6{com}.         quietly sum `lhsvar' if e(sample)
{txt}  7{com}.         quietly estadd scalar lhsmean = r(mean)
{txt}  8{com}.         quietly estadd scalar lhssd = r(sd)
{txt}  9{com}. {c )-}
{txt}
{com}. esttab, b(%5.4f) se(%5.4f) star(* 0.1 ** 0.05 *** 0.01) par label collabels(none) ar2 noconstant mtitles ///
> keep(detained) s(lhsmean lhssd fstat fes N, ///
> label("Mean(dep. var.)" "SD(dep. var.)" "1st Stage F-Stat" "Fixed Effects" "Observations") ///
> fmt(4 4 2 0 %9.0fc)) nonotes // bottom summary
{res}
{txt}{hline 148}
{txt}                              (1)             (2)             (3)             (4)             (5)             (6)             (7)             (8)   
{txt}                            Young             Old           Black        NonBlack            Male          Female    YoungPurch~e     OldPurchase   
{txt}{hline 148}
{txt}Detained            {res}       0.0278*         0.0211*         0.0215**        0.0396**        0.0255**        0.0102          0.0286**        0.0193   {txt}
                    {res} {ralign 12:{txt:(}0.0145{txt:)}}    {ralign 12:{txt:(}0.0117{txt:)}}    {ralign 12:{txt:(}0.0107{txt:)}}    {ralign 12:{txt:(}0.0177{txt:)}}    {ralign 12:{txt:(}0.0109{txt:)}}    {ralign 12:{txt:(}0.0175{txt:)}}    {ralign 12:{txt:(}0.0138{txt:)}}    {ralign 12:{txt:(}0.0124{txt:)}}   {txt}
{txt}{hline 148}
{txt}Mean(dep. var.)     {res}       0.1495          0.1464          0.1431          0.1638          0.1483          0.1453          0.1453          0.1504   {txt}
{txt}SD(dep. var.)       {res}       0.3566          0.3535          0.3501          0.3701          0.3554          0.3524          0.3524          0.3575   {txt}
{txt}1st Stage F-Stat    {res}      2427.38         2654.46         4078.64         1242.06         3774.72          914.08         2640.48         2656.64   {txt}
{txt}Fixed Effects       {res}          Yes             Yes             Yes             Yes             Yes             Yes             Yes             Yes   {txt}
{txt}Observations        {res}      136,021         138,445         210,908          63,569         231,031          43,393         137,536         136,914   {txt}
{txt}{hline 148}

{com}. 
. * Table 11a output
. esttab using output\tables\table11a.tex, replace mtitles ///
> b(%5.4f) se(%5.4f) star(* 0.1 ** 0.05 *** 0.01) par label collabels(none) ar2 ///
> keep(detained) s(lhsmean lhssd fstat fes N, ///
> label("Mean(dep. var.)" "SD(dep. var.)" "1st Stage F-Stat" "Fixed Effects" "Observations") ///
> fmt(4 4 2 0 %9.0fc)) nonotes booktabs // bottom summary
{res}{txt}(output written to {browse  `"output\tables\table11a.tex"'})

{com}. 
. * Panel A - heterogeneity in housing characteristics
. local lhsvar "zinsolvent_3yr"
{txt}
{com}. local iv "detained = $rivror"
{txt}
{com}. local subfilter1 "preprice_high==1"
{txt}
{com}. local subfilter2 "preprice_high==0"
{txt}
{com}. local subfilter3 "preloanamt>0 & !missing(preloanamt)"
{txt}
{com}. local subfilter4 "preloanamt==0 & !missing(preloanamt)"
{txt}
{com}. local subfilter5 "prematurity_high==1"
{txt}
{com}. local subfilter6 "prematurity_high==0"
{txt}
{com}. local subfilter7 "neg_hpichange==1"
{txt}
{com}. local subfilter8 "neg_hpichange==0"
{txt}
{com}. local subfilterlab1 "HighPrice"
{txt}
{com}. local subfilterlab2 "LowPrice"
{txt}
{com}. local subfilterlab3 "Mortgage"
{txt}
{com}. local subfilterlab4 "NoMortgage"
{txt}
{com}. local subfilterlab5 "LongMaturity"
{txt}
{com}. local subfilterlab6 "ShortMaturity"
{txt}
{com}. local subfilterlab7 "NegHPIgr"
{txt}
{com}. local subfilterlab8 "PosHPIgr"
{txt}
{com}. eststo clear
{txt}
{com}. forvalues i=1/8  {c -(}
{txt}  2{com}.         eststo `subfilterlab`i'': quietly ivreghdfe `lhsvar' (`iv') if $tsfilters & $zfilters & `subfilter`i'', absorb($fevars) cluster($ivclustvar) ffirst
{txt}  3{com}.         matrix firstmat = e(first) // First-stage statistics
{txt}  4{com}.         quietly estadd scalar fstat = firstmat[4,1] // Store first-stage F-stat 
{txt}  5{com}.         quietly estadd local fes "Yes"
{txt}  6{com}.         quietly sum `lhsvar' if e(sample)
{txt}  7{com}.         quietly estadd scalar lhsmean = r(mean)
{txt}  8{com}.         quietly estadd scalar lhssd = r(sd)
{txt}  9{com}. {c )-}
{txt}
{com}. esttab, b(%5.4f) se(%5.4f) star(* 0.1 ** 0.05 *** 0.01) par label collabels(none) ar2 noconstant mtitles ///
> keep(detained) s(lhsmean lhssd fstat fes N, ///
> label("Mean(dep. var.)" "SD(dep. var.)" "1st Stage F-Stat" "Fixed Effects" "Observations") ///
> fmt(4 4 2 0 %9.0fc)) nonotes // bottom summary
{res}
{txt}{hline 148}
{txt}                              (1)             (2)             (3)             (4)             (5)             (6)             (7)             (8)   
{txt}                        HighPrice        LowPrice        Mortgage      NoMortgage    LongMaturity    ShortMatur~y        NegHPIgr        PosHPIgr   
{txt}{hline 148}
{txt}Detained            {res}       0.0532***       0.0022          0.0386**        0.0158          0.0548**        0.0236          0.0370**        0.0162   {txt}
                    {res} {ralign 12:{txt:(}0.0185{txt:)}}    {ralign 12:{txt:(}0.0159{txt:)}}    {ralign 12:{txt:(}0.0152{txt:)}}    {ralign 12:{txt:(}0.0115{txt:)}}    {ralign 12:{txt:(}0.0270{txt:)}}    {ralign 12:{txt:(}0.0201{txt:)}}    {ralign 12:{txt:(}0.0156{txt:)}}    {ralign 12:{txt:(}0.0104{txt:)}}   {txt}
{txt}{hline 148}
{txt}Mean(dep. var.)     {res}       0.1715          0.1130          0.1627          0.1280          0.1925          0.1460          0.1784          0.1283   {txt}
{txt}SD(dep. var.)       {res}       0.3770          0.3166          0.3690          0.3341          0.3943          0.3532          0.3828          0.3344   {txt}
{txt}1st Stage F-Stat    {res}      1692.12         1524.98         3306.98         2793.14         1081.42         1929.64         3796.09         4141.66   {txt}
{txt}Fixed Effects       {res}          Yes             Yes             Yes             Yes             Yes             Yes             Yes             Yes   {txt}
{txt}Observations        {res}       68,166          67,845         118,708         137,997          46,046          45,869         107,357         166,155   {txt}
{txt}{hline 148}

{com}. 
. * Table 11b output
. esttab using output\tables\table11b.tex, replace mtitles ///
> b(%5.4f) se(%5.4f) star(* 0.1 ** 0.05 *** 0.01) par label collabels(none) ar2 ///
> keep(detained) s(lhsmean lhssd fstat fes N, ///
> label("Mean(dep. var.)" "SD(dep. var.)" "1st Stage F-Stat" "Fixed Effects" "Observations") ///
> fmt(4 4 2 0 %9.0fc)) nonotes booktabs // bottom summary
{res}{txt}(output written to {browse  `"output\tables\table11b.tex"'})

{com}. 
. *------------------------------------------------------------------------
. * Table 12 - Heterogeneous effects on property bonds and commercial bonds
. *------------------------------------------------------------------------
. 
. * Heterogeneous effects on property bonds 
. local lhsvar "bond_prop"
{txt}
{com}. local iv "detained = $rivror"
{txt}
{com}. local subfilter1 "neg_hpichange==1"
{txt}
{com}. local subfilter2 "neg_hpichange==0"
{txt}
{com}. local subfilter3 "prematurity_high==1"
{txt}
{com}. local subfilter4 "prematurity_high==0"
{txt}
{com}. local subfilterlab1 "NegHPIgr"
{txt}
{com}. local subfilterlab2 "PosHPIgr"
{txt}
{com}. local subfilterlab3 "LongMaturity"
{txt}
{com}. local subfilterlab4 "ShortMaturity"
{txt}
{com}. eststo clear
{txt}
{com}. forvalues i=1/4  {c -(}
{txt}  2{com}.         eststo `subfilterlab`i'': quietly ivreghdfe `lhsvar' (`iv') if $tsfilters & $zfilters & `subfilter`i'', absorb($fevars) cluster($ivclustvar) ffirst
{txt}  3{com}.         matrix firstmat = e(first) // First-stage statistics
{txt}  4{com}.         quietly estadd scalar fstat = firstmat[4,1] // Store first-stage F-stat 
{txt}  5{com}.         quietly estadd local fes "Yes"
{txt}  6{com}.         quietly sum `lhsvar' if e(sample)
{txt}  7{com}.         quietly estadd scalar lhsmean = r(mean)
{txt}  8{com}.         quietly estadd scalar lhssd = r(sd)
{txt}  9{com}. {c )-}
{txt}
{com}. esttab, b(%5.4f) se(%5.4f) star(* 0.1 ** 0.05 *** 0.01) par label collabels(none) ar2 noconstant mtitles ///
> keep(detained) s(lhsmean lhssd fstat fes N, ///
> label("Mean(dep. var.)" "SD(dep. var.)" "1st Stage F-Stat" "Fixed Effects" "Observations") ///
> fmt(4 4 2 0 %9.0fc)) nonotes // bottom summary
{res}
{txt}{hline 84}
{txt}                              (1)             (2)             (3)             (4)   
{txt}                         NegHPIgr        PosHPIgr    LongMaturity    ShortMatur~y   
{txt}{hline 84}
{txt}Detained            {res}       0.0151          0.0525***       0.0215          0.0409***{txt}
                    {res} {ralign 12:{txt:(}0.0102{txt:)}}    {ralign 12:{txt:(}0.0092{txt:)}}    {ralign 12:{txt:(}0.0167{txt:)}}    {ralign 12:{txt:(}0.0131{txt:)}}   {txt}
{txt}{hline 84}
{txt}Mean(dep. var.)     {res}       0.0199          0.0347          0.0288          0.0222   {txt}
{txt}SD(dep. var.)       {res}       0.1397          0.1830          0.1672          0.1473   {txt}
{txt}1st Stage F-Stat    {res}      3796.09         4141.66         1081.42         1929.64   {txt}
{txt}Fixed Effects       {res}          Yes             Yes             Yes             Yes   {txt}
{txt}Observations        {res}      107,357         166,155          46,046          45,869   {txt}
{txt}{hline 84}

{com}. 
. * Table 12a output
. esttab using output\tables\table12a.tex, replace mtitles ///
> b(%5.4f) se(%5.4f) star(* 0.1 ** 0.05 *** 0.01) par label collabels(none) ar2 ///
> keep(detained) s(lhsmean lhssd fstat fes N, ///
> label("Mean(dep. var.)" "SD(dep. var.)" "1st Stage F-Stat" "Fixed Effects" "Observations") ///
> fmt(4 4 2 0 %9.0fc)) nonotes booktabs // bottom summary
{res}{txt}(output written to {browse  `"output\tables\table12a.tex"'})

{com}. 
. * Heterogeneous effects on commercial bonds
. local lhsvar "bond_corp"
{txt}
{com}. local iv "detained = $rivror"
{txt}
{com}. local subfilter1 "neg_hpichange==1"
{txt}
{com}. local subfilter2 "neg_hpichange==0"
{txt}
{com}. local subfilter3 "prematurity_high==1"
{txt}
{com}. local subfilter4 "prematurity_high==0"
{txt}
{com}. local subfilterlab1 "NegHPIgr"
{txt}
{com}. local subfilterlab2 "PosHPIgr"
{txt}
{com}. local subfilterlab3 "LongMaturity"
{txt}
{com}. local subfilterlab4 "ShortMaturity"
{txt}
{com}. eststo clear
{txt}
{com}. forvalues i=1/4  {c -(}
{txt}  2{com}.         eststo `subfilterlab`i'': quietly ivreghdfe `lhsvar' (`iv') if $tsfilters & $zfilters & `subfilter`i'', absorb($fevars) cluster($ivclustvar) ffirst
{txt}  3{com}.         matrix firstmat = e(first) // First-stage statistics
{txt}  4{com}.         quietly estadd scalar fstat = firstmat[4,1] // Store first-stage F-stat 
{txt}  5{com}.         quietly estadd local fes "Yes"
{txt}  6{com}.         quietly sum `lhsvar' if e(sample)
{txt}  7{com}.         quietly estadd scalar lhsmean = r(mean)
{txt}  8{com}.         quietly estadd scalar lhssd = r(sd)
{txt}  9{com}. {c )-}
{txt}
{com}. esttab, b(%5.4f) se(%5.4f) star(* 0.1 ** 0.05 *** 0.01) par label collabels(none) ar2 noconstant mtitles ///
> keep(detained) s(lhsmean lhssd fstat fes N, ///
> label("Mean(dep. var.)" "SD(dep. var.)" "1st Stage F-Stat" "Fixed Effects" "Observations") ///
> fmt(4 4 2 0 %9.0fc)) nonotes // bottom summary
{res}
{txt}{hline 84}
{txt}                              (1)             (2)             (3)             (4)   
{txt}                         NegHPIgr        PosHPIgr    LongMaturity    ShortMatur~y   
{txt}{hline 84}
{txt}Detained            {res}       0.1516***       0.2434***       0.1403***       0.1384***{txt}
                    {res} {ralign 12:{txt:(}0.0408{txt:)}}    {ralign 12:{txt:(}0.0284{txt:)}}    {ralign 12:{txt:(}0.0403{txt:)}}    {ralign 12:{txt:(}0.0386{txt:)}}   {txt}
{txt}{hline 84}
{txt}Mean(dep. var.)     {res}       0.1388          0.1809          0.1315          0.1261   {txt}
{txt}SD(dep. var.)       {res}       0.3457          0.3850          0.3379          0.3319   {txt}
{txt}1st Stage F-Stat    {res}      3796.09         4141.66         1081.42         1929.64   {txt}
{txt}Fixed Effects       {res}          Yes             Yes             Yes             Yes   {txt}
{txt}Observations        {res}      107,357         166,155          46,046          45,869   {txt}
{txt}{hline 84}

{com}. 
. * Table 12b output
. esttab using output\tables\table12b.tex, replace mtitles ///
> b(%5.4f) se(%5.4f) star(* 0.1 ** 0.05 *** 0.01) par label collabels(none) ar2 ///
> keep(detained) s(lhsmean lhssd fstat fes N, ///
> label("Mean(dep. var.)" "SD(dep. var.)" "1st Stage F-Stat" "Fixed Effects" "Observations") ///
> fmt(4 4 2 0 %9.0fc)) nonotes booktabs // bottom summary
{res}{txt}(output written to {browse  `"output\tables\table12b.tex"'})

{com}. 
. *--------------------------------------------------
. * Table 13 - evaluating FTA mechanism (OLS)
. *--------------------------------------------------
. 
. * Create interaction term
. gen fta_detained = wari_fta * detained
{txt}
{com}. label variable fta_detained "FailToAppear x Detained"
{txt}
{com}. 
. * Effect of FTA x Detained on insolvency measures
. eststo clear
{txt}
{com}. local cutvar "detained"
{txt}
{com}. local rhsvar "wari_fta fta_detained detained"
{txt}
{com}. local lhsvar1 "zinsolvent_3yr"
{txt}
{com}. local lhsvar2 "zinsolvent_dmf_3yr"
{txt}
{com}. local lhsvar3 "zinsolvent_fmf_3yr"
{txt}
{com}. local lhsvar4 "zinsolvent_nml_3yr"
{txt}
{com}. local lhsvar5 "zinsolvent_ndl_3yr"
{txt}
{com}. forvalues i=1/5 {c -(}
{txt}  2{com}.         eststo model`i': quietly reghdfe `lhsvar`i'' `rhsvar' if $tsfilters & $zfilters, absorb($fevars) cluster($ivclustvar) 
{txt}  3{com}.         matrix firstmat = e(first) // First-stage statistics
{txt}  4{com}.         quietly estadd scalar fstat = firstmat[4,1] // Store first-stage F-stat 
{txt}  5{com}.         quietly estadd local fes "Yes"
{txt}  6{com}.         quietly sum `lhsvar`i'' if e(sample)
{txt}  7{com}.         quietly estadd scalar lhsmean = r(mean)
{txt}  8{com}.         quietly estadd scalar lhssd = r(sd)
{txt}  9{com}.         
. {c )-}
{txt}
{com}. esttab, b(%5.4f) se(%5.4f) star(* 0.1 ** 0.05 *** 0.01) par depvars label collabels(none) ar2 ///
> keep(detained wari_fta fta_*) order(detained wari_fta) s(lhsmean lhssd fes N, ///
> label("Mean(dep. var.)" "SD(dep. var.)" "Fixed Effects" "Observations") ///
> fmt(4 4 0 %9.0fc)) nonotes // bottom summary
{res}
{txt}{hline 100}
{txt}                              (1)             (2)             (3)             (4)             (5)   
{txt}                          3 Years    InsolventDef    InsolventF~y    InsolventN~e    InsolventU~d   
{txt}{hline 100}
{txt}Detained            {res}       0.0043**       -0.0026***      -0.0020**       -0.0019*         0.0062***{txt}
                    {res} {ralign 12:{txt:(}0.0018{txt:)}}    {ralign 12:{txt:(}0.0006{txt:)}}    {ralign 12:{txt:(}0.0009{txt:)}}    {ralign 12:{txt:(}0.0011{txt:)}}    {ralign 12:{txt:(}0.0016{txt:)}}   {txt}

{txt}FailToAppear        {res}       0.0080***      -0.0015         -0.0045***      -0.0025          0.0106***{txt}
                    {res} {ralign 12:{txt:(}0.0030{txt:)}}    {ralign 12:{txt:(}0.0011{txt:)}}    {ralign 12:{txt:(}0.0012{txt:)}}    {ralign 12:{txt:(}0.0018{txt:)}}    {ralign 12:{txt:(}0.0024{txt:)}}   {txt}

{txt}FailToAppear x Det~d{res}       0.0266***       0.0308***       0.0088***       0.0331***      -0.0066   {txt}
                    {res} {ralign 12:{txt:(}0.0059{txt:)}}    {ralign 12:{txt:(}0.0044{txt:)}}    {ralign 12:{txt:(}0.0025{txt:)}}    {ralign 12:{txt:(}0.0048{txt:)}}    {ralign 12:{txt:(}0.0044{txt:)}}   {txt}
{txt}{hline 100}
{txt}Mean(dep. var.)     {res}       0.1479          0.0160          0.0336          0.0491          0.0988   {txt}
{txt}SD(dep. var.)       {res}       0.3550          0.1256          0.1802          0.2162          0.2983   {txt}
{txt}Fixed Effects       {res}          Yes             Yes             Yes             Yes             Yes   {txt}
{txt}Observations        {res}      275,820         275,820         275,820         275,820         275,820   {txt}
{txt}{hline 100}

{com}. 
. * Table 13 output
. esttab using output\tables\table13.tex, replace b(%5.4f) se(%5.4f) star(* 0.1 ** 0.05 *** 0.01) par depvars label collabels(none) ar2 ///
> keep(detained wari_fta fta_*) order(detained wari_fta) s(lhsmean lhssd fes N, ///
> label("Mean(dep. var.)" "SD(dep. var.)" "Fixed Effects" "Observations") ///
> fmt(4 4 0 %9.0fc)) nonotes booktabs // bottom summary
{res}{txt}(output written to {browse  `"output\tables\table13.tex"'})

{com}. 
. **************************************************************************************************************
. 
. * Close log
. log close
      {txt}name:  {res}<unnamed>
       {txt}log:  {res}H:\Dropbox\work\replicationpack\logs\3_Output.smcl
  {txt}log type:  {res}smcl
 {txt}closed on:  {res}29 Nov 2024, 21:34:43
{txt}{.-}
{smcl}
{txt}{sf}{ul off}